diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2016-04-25 15:51:06 +0100 |
---|---|---|
committer | VLetrmx <richardipsum@fastmail.co.uk> | 2016-06-17 18:41:48 +0000 |
commit | be50939c9e5732c626e17762eeea52cb5909d130 (patch) | |
tree | 00ba473c607b32d63a8d4022f4238ed91488db71 /lorrycontroller | |
parent | 9632874369753767a42d5617ee0ea888bf1b18b4 (diff) | |
download | lorry-controller-be50939c9e5732c626e17762eeea52cb5909d130.tar.gz |
Allow host to be specified instead of trovehost
Change-Id: I23c23886b5389d75032c64bf4e78db7edca1af63
Diffstat (limited to 'lorrycontroller')
-rw-r--r-- | lorrycontroller/readconf.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py index 5323a3f..aee2462 100644 --- a/lorrycontroller/readconf.py +++ b/lorrycontroller/readconf.py @@ -71,7 +71,7 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): lorries_to_remove = lorries_to_remove.difference(added) elif section['type'] in ('trove', 'troves', 'gitlab'): self.add_trove(statedb, section) - trovehost = section['trovehost'] + trovehost = section.get('host') or section['trovehost'] if trovehost in troves_to_remove: troves_to_remove.remove(trovehost) lorries_to_remove = lorries_to_remove.difference( @@ -291,7 +291,7 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): gitlab_token = section['private-token'] statedb.add_trove( - trovehost=section['trovehost'], + trovehost=section.get('host') or section['trovehost'], protocol=section['protocol'], username=username, password=password, @@ -351,9 +351,11 @@ class LorryControllerConfValidator(object): self._check_has_required_fields(section, ['private-token']) def _check_troves_section(self, section): + if not any(i in ('trovehost', 'host') for i in section): + self._check_has_required_fields(section, ['host']) self._check_has_required_fields( section, - ['trovehost', 'protocol', 'interval', 'ls-interval', 'prefixmap']) + ['protocol', 'interval', 'ls-interval', 'prefixmap']) self._check_protocol(section) self._check_prefixmap(section) if 'ignore' in section: |