From 0c0d6c0b4ef2ae31a6a8585180cedc00e3885e09 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Tue, 28 May 2013 12:53:51 +0200 Subject: [PATCH] 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 --- lib/ansible/inventory/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index 3d407a92c0..55d8e0b06e 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -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