mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
performance optimization in inventory.groups_list()
don't calculate all hosts for every parent group of every group when that parent group was already in the cache
This commit is contained in:
parent
5ec35fa388
commit
0c0d6c0b4e
1 changed files with 2 additions and 1 deletions
|
@ -233,7 +233,8 @@ class Inventory(object):
|
|||
groups[g.name] = [h.name for h in g.get_hosts()]
|
||||
ancestors = g.get_ancestors()
|
||||
for a in ancestors:
|
||||
groups[a.name] = [h.name for h in a.get_hosts()]
|
||||
if a.name not in groups:
|
||||
groups[a.name] = [h.name for h in a.get_hosts()]
|
||||
self._groups_list = groups
|
||||
return self._groups_list
|
||||
|
||||
|
|
Loading…
Reference in a new issue