@ -473,30 +473,21 @@ class Inventory(object):
"""
"""
results = [ ]
results = [ ]
hostnames = set ( )
def __append_host_to_results ( host ) :
def __append_host_to_results ( host ) :
if host . name not in hostname s:
if host . name not in result s:
hostnames . add ( host . name )
if not host . implicit :
results . append ( host )
results . append ( host )
groups = self . get_groups ( )
groups = self . get_groups ( )
for group in groups . values ( ) :
for group in groups . values ( ) :
if pattern == ' all ' :
if self . _match ( group . name , pattern ) :
for host in group . get_hosts ( ) :
for host in group . get_hosts ( ) :
if host . implicit :
continue
__append_host_to_results ( host )
__append_host_to_results ( host )
else :
else :
if self . _match ( group . name , pattern ) and group . name not in ( ' all ' , ' ungrouped ' ) :
matching_hosts = self . _match_list ( group . get_hosts ( ) , ' name ' , pattern )
for host in group . get_hosts ( ) :
for host in matching_hosts :
if host . implicit :
__append_host_to_results ( host )
continue
__append_host_to_results ( host )
else :
matching_hosts = self . _match_list ( group . get_hosts ( ) , ' name ' , pattern )
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 )