Parse multiple ports from environment

This commit is contained in:
Christophe Mehay 2017-02-09 09:39:02 +01:00
parent f5b25abd3c
commit 3843fe5bd3
5 changed files with 17 additions and 11 deletions

View file

@ -17,6 +17,6 @@ post_conf_commands:
reload:
files:
- /etc/torrc
- /etc/tor/torrc
debug: false

View file

@ -45,10 +45,11 @@ class Setup(object):
self._add_host(host)
if 'ports' not in self.setup[host]:
self.setup[host]['ports'] = []
port = [int(p) for p in ports.split(':')]
assert len(port) == 2
if port not in self.setup[host]['ports']:
self.setup[host]['ports'].append(port)
ports_l = [[int(v) for v in sp.split(':')] for sp in ports.split(',')]
for port in ports_l:
assert len(port) == 2
if port not in self.setup[host]['ports']:
self.setup[host]['ports'].append(port)
def _get_ip(self):
for host in self.setup: