parent
c3c398cffe
commit
90445ee67d
|
@ -372,7 +372,7 @@ class Inventory(object):
|
||||||
for host in matching_hosts:
|
for host in matching_hosts:
|
||||||
__append_host_to_results(host)
|
__append_host_to_results(host)
|
||||||
|
|
||||||
if pattern in ["localhost", "127.0.0.1"] and len(results) == 0:
|
if pattern in ["localhost", "127.0.0.1", "::1"] and len(results) == 0:
|
||||||
new_host = self._create_implicit_localhost(pattern)
|
new_host = self._create_implicit_localhost(pattern)
|
||||||
results.append(new_host)
|
results.append(new_host)
|
||||||
return results
|
return results
|
||||||
|
@ -408,9 +408,9 @@ class Inventory(object):
|
||||||
return self._hosts_cache[hostname]
|
return self._hosts_cache[hostname]
|
||||||
|
|
||||||
def _get_host(self, hostname):
|
def _get_host(self, hostname):
|
||||||
if hostname in ['localhost','127.0.0.1']:
|
if hostname in ['localhost', '127.0.0.1', '::1']:
|
||||||
for host in self.get_group('all').get_hosts():
|
for host in self.get_group('all').get_hosts():
|
||||||
if host.name in ['localhost', '127.0.0.1']:
|
if host.name in ['localhost', '127.0.0.1', '::1']:
|
||||||
return host
|
return host
|
||||||
return self._create_implicit_localhost(hostname)
|
return self._create_implicit_localhost(hostname)
|
||||||
else:
|
else:
|
||||||
|
@ -512,7 +512,7 @@ class Inventory(object):
|
||||||
""" return a list of hostnames for a pattern """
|
""" return a list of hostnames for a pattern """
|
||||||
|
|
||||||
result = [ h for h in self.get_hosts(pattern) ]
|
result = [ h for h in self.get_hosts(pattern) ]
|
||||||
if len(result) == 0 and pattern in ["localhost", "127.0.0.1"]:
|
if len(result) == 0 and pattern in ["localhost", "127.0.0.1", "::1"]:
|
||||||
result = [pattern]
|
result = [pattern]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue