summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2016-04-25 15:51:06 +0100
committerVLetrmx <richardipsum@fastmail.co.uk>2016-06-17 18:41:48 +0000
commitbe50939c9e5732c626e17762eeea52cb5909d130 (patch)
tree00ba473c607b32d63a8d4022f4238ed91488db71
parent9632874369753767a42d5617ee0ea888bf1b18b4 (diff)
downloadlorry-controller-be50939c9e5732c626e17762eeea52cb5909d130.tar.gz
Allow host to be specified instead of trovehost
Change-Id: I23c23886b5389d75032c64bf4e78db7edca1af63
-rw-r--r--README5
-rw-r--r--lorrycontroller/readconf.py8
2 files changed, 7 insertions, 6 deletions
diff --git a/README b/README
index 5fe1d93..e3ba0f4 100644
--- a/README
+++ b/README
@@ -81,7 +81,7 @@ exist).
"delta": "delta"
},
"protocol": "http",
- "trovehost": "git.baserock.org",
+ "host": "git.baserock.org",
"type": "trove"
},
{
@@ -98,8 +98,7 @@ A Trove specification (map) uses the following mandatory keys:
* `type: trove` -- specify it's a Trove specification.
-* `trovehost` -- the other Trove to mirror; a domain name or IP
- address.
+* `host` -- the other Trove to mirror; a domain name or IP address.
* `protocol` -- specify how Lorry Controller (and Lorry) should talk
to other Troves. Allowed values are `ssh`, `https`, `http`.
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: