Skip to content

Commit

Permalink
set _hosts on access if None
Browse files Browse the repository at this point in the history
hopefully bpyass srlz10n issues to fix ansible#30903
  • Loading branch information
bcoca committed Sep 29, 2017
1 parent 43cbcbc commit 56d47e6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ansible/inventory/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
__metaclass__ = type

from ansible.errors import AnsibleError
from ansible.utils.vars import combine_vars


class Group:
Expand Down Expand Up @@ -72,16 +71,20 @@ def deserialize(self, data):
self.name = data.get('name')
self.vars = data.get('vars', dict())
self.depth = data.get('depth', 0)
self.hosts = data.get('hosts', {})

self._hosts = set(self.hosts)
self.hosts = data.get('hosts', [])

parent_groups = data.get('parent_groups', [])
for parent_data in parent_groups:
g = Group()
g.deserialize(parent_data)
self.parent_groups.append(g)

@property
def _hosts(self):
if self._hosts is None:
self._hosts = set(self.hosts)
return self._hosts

def get_name(self):
return self.name

Expand Down

0 comments on commit 56d47e6

Please sign in to comment.