parent
9ffad27319
commit
eb0b1e149d
1 changed files with 10 additions and 2 deletions
|
@ -480,18 +480,26 @@ class Inventory(object):
|
||||||
results.append(host)
|
results.append(host)
|
||||||
|
|
||||||
groups = self.get_groups()
|
groups = self.get_groups()
|
||||||
|
matched = False
|
||||||
for group in groups.values():
|
for group in groups.values():
|
||||||
if self._match(group.name, pattern):
|
if self._match(group.name, pattern):
|
||||||
|
matched = True
|
||||||
for host in group.get_hosts():
|
for host in group.get_hosts():
|
||||||
__append_host_to_results(host)
|
__append_host_to_results(host)
|
||||||
else:
|
else:
|
||||||
matching_hosts = self._match_list(group.get_hosts(), 'name', pattern)
|
matching_hosts = self._match_list(group.get_hosts(), 'name', pattern)
|
||||||
for host in matching_hosts:
|
if matching_hosts:
|
||||||
__append_host_to_results(host)
|
matched = True
|
||||||
|
for host in matching_hosts:
|
||||||
|
__append_host_to_results(host)
|
||||||
|
|
||||||
if pattern in C.LOCALHOST and len(results) == 0:
|
if pattern in C.LOCALHOST 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)
|
||||||
|
matched = True
|
||||||
|
|
||||||
|
if not matched:
|
||||||
|
display.warning("Could not match supplied host pattern, ignoring: %s" % pattern)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def _create_implicit_localhost(self, pattern):
|
def _create_implicit_localhost(self, pattern):
|
||||||
|
|
Loading…
Reference in a new issue