mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
Merge pull request #1623 from dhozac/group-hosts-set
Create a set of all the hosts in a group to prevent duplicates
This commit is contained in:
commit
73ae930659
1 changed files with 4 additions and 4 deletions
|
@ -50,11 +50,11 @@ class Group(object):
|
||||||
|
|
||||||
def get_hosts(self):
|
def get_hosts(self):
|
||||||
|
|
||||||
hosts = []
|
hosts = set()
|
||||||
for kid in self.child_groups:
|
for kid in self.child_groups:
|
||||||
hosts.extend(kid.get_hosts())
|
hosts.update(kid.get_hosts())
|
||||||
hosts.extend(self.hosts)
|
hosts.update(self.hosts)
|
||||||
return hosts
|
return list(hosts)
|
||||||
|
|
||||||
def get_variables(self):
|
def get_variables(self):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue