InventoryGroup("rgws", self.ar_client).update(hosts)
# Limit playbook execution to certain hosts
- limited = ",".join(hosts)
+ limited = ",".join(str(host) for host in hosts)
# Add the settings for this service
extravars = {k:v for (k,v) in spec.__dict__.items() if k.startswith('rgw_')}
logger = logging.getLogger(__name__)
-HostSpec = namedtuple('HostSpec', ['hostname', 'network', 'name'])
+class HostSpec(namedtuple('HostSpec', ['hostname', 'network', 'name'])):
+ def __str__(self):
+ res = ''
+ res += self.hostname
+ if self.network:
+ res += ':' + self.network
+ if self.name:
+ res += '=' + self.name
+ return res
def parse_host_specs(host, require_network=True):
def test_parse_host_specs(test_input, expected, require_network):
ret = parse_host_specs(test_input, require_network=require_network)
assert ret == expected
+ assert str(ret) == test_input
@pytest.mark.parametrize("test_input",
# wrong subnet