From 2e3195ffabe9aa2004160d82c24d534af3b4a2ae Mon Sep 17 00:00:00 2001 From: Ben Brown Date: Wed, 9 Dec 2015 16:25:53 +0000 Subject: 'ignore' field is no longer treated as if it were mandatory The README lists 'ignore' in the group of optional keys for trove specifications, yet any attempt to read the configuration without the key being present would result in a KeyError. Change-Id: I05121535b970c6d7382def46ffa720209f794633 --- lorrycontroller/lstroves.py | 5 +++-- lorrycontroller/readconf.py | 2 +- yarns.webapp/900-implementations.yarn | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lorrycontroller/lstroves.py b/lorrycontroller/lstroves.py index 72515f5..e4fbbd4 100644 --- a/lorrycontroller/lstroves.py +++ b/lorrycontroller/lstroves.py @@ -85,8 +85,9 @@ class TroveRepositoryLister(object): ignored_patterns = json.loads(trovehost['ignore']) ignored_paths = set() - for pattern in ignored_patterns: - ignored_paths.update(fnmatch.filter(repo_paths, pattern)) + if ignored_patterns: + for pattern in ignored_patterns: + ignored_paths.update(fnmatch.filter(repo_paths, pattern)) return set(repo_paths).difference(ignored_paths) diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py index a42458b..2eae4b3 100644 --- a/lorrycontroller/readconf.py +++ b/lorrycontroller/readconf.py @@ -296,7 +296,7 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): 'lorry-timeout', self.DEFAULT_LORRY_TIMEOUT), ls_interval=section['ls-interval'], prefixmap=json.dumps(section['prefixmap']), - ignore=json.dumps(section['ignore'])) + ignore=json.dumps(section.get('ignore'))) class ValidationError(Exception): diff --git a/yarns.webapp/900-implementations.yarn b/yarns.webapp/900-implementations.yarn index 455a993..e62f09d 100644 --- a/yarns.webapp/900-implementations.yarn +++ b/yarns.webapp/900-implementations.yarn @@ -132,7 +132,6 @@ most of the configuration. "interval": "0s", "ls-interval": "0s", "prefixmap": {}, - "ignore": [], } filename = os.path.join(DATADIR, MATCH_2, MATCH_1) -- cgit v1.2.1