diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2015-12-09 16:25:53 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-12-15 10:44:47 +0000 |
commit | 2e3195ffabe9aa2004160d82c24d534af3b4a2ae (patch) | |
tree | e130d9e06811e92e4d52577e61fcee8f23df3fc8 | |
parent | 357cc5b1a2cd1fe285475cb044777cace894f0b1 (diff) | |
download | lorry-controller-2e3195ffabe9aa2004160d82c24d534af3b4a2ae.tar.gz |
'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
-rw-r--r-- | lorrycontroller/lstroves.py | 5 | ||||
-rw-r--r-- | lorrycontroller/readconf.py | 2 | ||||
-rw-r--r-- | 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) |