From 604ee5f55698a7362dbeff7ee5be4f1c3e92cabe Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 7 May 2020 20:41:02 +0100 Subject: 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. --- lorrycontroller/readconf.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lorrycontroller') 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) -- cgit v1.2.1