diff options
Diffstat (limited to 'lorrycontroller')
-rw-r--r-- | lorrycontroller/readconf.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py index 2eae4b3..f7a7404 100644 --- a/lorrycontroller/readconf.py +++ b/lorrycontroller/readconf.py @@ -344,6 +344,8 @@ class LorryControllerConfValidator(object): ['trovehost', 'protocol', 'interval', 'ls-interval', 'prefixmap']) self._check_protocol(section) self._check_prefixmap(section) + if 'ignore' in section: + self._check_is_list_of_strings(section, 'ignore') def _check_protocol(self, section): valid = ('ssh', 'http', 'https') @@ -362,6 +364,7 @@ class LorryControllerConfValidator(object): def _check_lorries_section(self, section): self._check_has_required_fields( section, ['interval', 'prefix', 'globs']) + self._check_is_list_of_strings(section, 'globs') def _check_has_required_fields(self, section, fields): for field in fields: @@ -369,3 +372,11 @@ class LorryControllerConfValidator(object): raise ValidationError( 'mandatory field %s missing in section %r' % (field, section)) + + def _check_is_list_of_strings(self, section, field): + obj = section[field] + if not isinstance(obj, list) or not all( + isinstance(s, basestring) for s in obj): + raise ValidationError( + '%s field in %r must be a list of strings' % + (field, section)) |