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 /lorrycontroller | |
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
Diffstat (limited to 'lorrycontroller')
-rw-r--r-- | lorrycontroller/lstroves.py | 5 | ||||
-rw-r--r-- | lorrycontroller/readconf.py | 2 |
2 files changed, 4 insertions, 3 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): |