1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Revert "fix the get_hosts() error in get_groups returning a dict not a list of group objects"

This reverts commit f41fb90d78fa464e9ad90b63a64bbd48e240c8c2.
This commit is contained in:
Michael DeHaan 2012-05-07 21:46:36 -04:00
parent 121d7c4ece
commit e1914a0e62

View file

@ -73,14 +73,14 @@ class Inventory(object):
hosts = {} hosts = {}
patterns = pattern.replace(";",":").split(":") patterns = pattern.replace(";",":").split(":")
for (groupname, group) in self.get_groups().items(): for group in self.get_groups():
for host in group.get_hosts(): for host in group.get_hosts():
for pat in patterns: for pat in patterns:
if group.name == pat or pat == 'all' or self._match(host.name, pat): if group.name == pat or pat == 'all' or self._match(host.name, pat):
if not self._restriction: if not self._restriction:
hosts[host.name] = host hosts[host.name] = host
if self._restriction and host.name in self._restriction: if self._restriction and host.name in self._restriction:
hosts[host.name] = host hosts[host.name] = host
return sorted(hosts.values(), key=lambda x: x.name) return sorted(hosts.values(), key=lambda x: x.name)
def get_groups(self): def get_groups(self):