commit: 5c4b8d7eceee333f803941f40d2cc757ecf5f80b Author: Pavlos Ratis <dastergon <AT> gentoo <DOT> org> AuthorDate: Thu Jan 8 17:08:51 2015 +0000 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> CommitDate: Thu Jan 8 17:08:51 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=5c4b8d7e
add checks to fetch-seed in case of missing category Added a check about categories in fetch-seed action because it failed when the command ran without a category --- gkeys/gkeys/actions.py | 3 ++- gkeys/gkeys/seedhandler.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py index eef338e..4db3757 100644 --- a/gkeys/gkeys/actions.py +++ b/gkeys/gkeys/actions.py @@ -81,9 +81,10 @@ class Actions(object): def fetchseed(self, args): '''Download the selected seed file(s)''' self.logger.debug("ACTIONS: fetchseed; args: %s" % str(args)) + if not args.category: + return (False, ["Please specify seeds category."]) handler = SeedHandler(self.logger, self.config) success, messages = handler.fetch_seeds(args.category, args, self.verify) - messages.append("") messages.append("Fetch operation completed") return (False not in success, messages) diff --git a/gkeys/gkeys/seedhandler.py b/gkeys/gkeys/seedhandler.py index 600ac35..5f15222 100644 --- a/gkeys/gkeys/seedhandler.py +++ b/gkeys/gkeys/seedhandler.py @@ -142,10 +142,10 @@ class SeedHandler(object): for seed in [seeds]: seedurl = self.config.get_key('seedurls', seed) seedpath = self.config.get_key('seeds', seed) - if http_check.match(seedurl): + if seedurl and seedpath and http_check.match(seedurl): urls.extend([(seed, seedurl, seedpath)]) else: - self.logger.info("Wrong seed file URLs... Skipping: %s" % seed) + self.logger.info("Wrong seed file URLs/seed path... Skipping: %s" % seed) except KeyError: pass succeeded = []