From c65cbceb19e827af834845166f7673f497ac4133 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Wed, 1 Apr 2020 13:22:50 +0000 Subject: [PATCH] Add support for fqdns to get_unit_hostnames --- zaza/openstack/utilities/generic.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/utilities/generic.py b/zaza/openstack/utilities/generic.py index e342369..9143297 100644 --- a/zaza/openstack/utilities/generic.py +++ b/zaza/openstack/utilities/generic.py @@ -113,11 +113,14 @@ def get_network_config(net_topology, ignore_env_vars=False, return net_info -def get_unit_hostnames(units): +def get_unit_hostnames(units, fqdn=False): """Return a dict of juju unit names to hostnames.""" host_names = {} for unit in units: - output = model.run_on_unit(unit.entity_id, 'hostname') + cmd = 'hostname' + if fqdn: + cmd = cmd + ' -f' + output = model.run_on_unit(unit.entity_id, cmd) hostname = output['Stdout'].strip() host_names[unit.entity_id] = hostname return host_names