From 17e4ce97a4f3d40ea5b6e48ac2efa114d6f91995 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Wed, 14 Nov 2012 13:35:21 +0100 Subject: [PATCH] Create a set of all the hosts in a group to prevent duplicates Fixes #1516. --- lib/ansible/inventory/group.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/inventory/group.py b/lib/ansible/inventory/group.py index 599b53c0a09..80d72b17b50 100644 --- a/lib/ansible/inventory/group.py +++ b/lib/ansible/inventory/group.py @@ -50,11 +50,11 @@ class Group(object): def get_hosts(self): - hosts = [] + hosts = set() for kid in self.child_groups: - hosts.extend(kid.get_hosts()) - hosts.extend(self.hosts) - return hosts + hosts.update(kid.get_hosts()) + hosts.update(self.hosts) + return list(hosts) def get_variables(self):