Return all aliases found for a hostname
Initially the method just returned the first set of aliases that were fonud for
a given hostname.
Most hosts now have ipv4 and ipv6 addresses that might have a different set of
aliases, so the combination of both should be returned instead.
Fix bsc#1120717
@@ -36,11 +36,12 @@ def get_aliases(hostname):
:return: [string]
"""
hosts = get_hosts()
+ found_aliases = set([hostname])
for host, aliases in iteritems(hosts):
if hostname in aliases:
+ found_aliases.update(set(aliases))
__utils__['caasp_log.debug']('CaaS: retrieved aliases %s for %s', aliases, hostname)
- return aliases
- return [hostname]
+ return found_aliases
def get_iface_ip(iface, host=None, ifaces=None):
