diff options
author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-05-07 20:41:02 +0100 |
---|---|---|
committer | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-06-01 15:27:22 +0100 |
commit | 604ee5f55698a7362dbeff7ee5be4f1c3e92cabe (patch) | |
tree | fa3b2690b58fab3fe9e67eddd31da93e8cdb39c4 /lorrycontroller | |
parent | d7a7e483a3792f8d7b9af0ee8f45000a44e5e881 (diff) | |
download | lorry-controller-604ee5f55698a7362dbeff7ee5be4f1c3e92cabe.tar.gz |
lorrycontroller.readconf: Fix up 'troves' section type early
The 'troves' section type is an alias for 'trove'. Replace it
with the latter in LorryControllerConfValidator() before anything
else sees it.
Diffstat (limited to 'lorrycontroller')
-rw-r--r-- | lorrycontroller/readconf.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py index b8b4a87..09a9f52 100644 --- a/lorrycontroller/readconf.py +++ b/lorrycontroller/readconf.py @@ -70,7 +70,7 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): added = self.add_matching_lorries_to_statedb( statedb, section) lorries_to_remove = lorries_to_remove.difference(added) - elif section['type'] in ('trove', 'troves', 'gitlab'): + elif section['type'] in ('trove', 'gitlab'): self.add_host(statedb, section) host = section.get('host') or section['trovehost'] if host in hosts_to_remove: @@ -325,7 +325,10 @@ class LorryControllerConfValidator(object): if 'type' not in section: raise ValidationError( 'section without type: %r' % section) - elif section['type'] in ('trove', 'troves'): + # Backward compatibility + if section['type'] == 'troves': + section['type'] = 'trove' + if section['type'] == 'trove': self._check_host_section(section) elif section['type'] == 'lorries': self._check_lorries_section(section) |