Added _meta hostvars key to gce.py plugin per the discussion in issue #9291.

This commit is contained in:
David Kirchner 2014-10-14 14:43:28 +00:00
parent bdf3ec1e21
commit 959520115c

View file

@ -229,9 +229,14 @@ class GceInventory(object):
def group_instances(self):
'''Group all instances'''
groups = {}
meta = {}
meta["hostvars"] = {}
for node in self.driver.list_nodes():
name = node.name
meta["hostvars"][name] = self.node_to_dict(node)
zone = node.extra['zone'].name
if groups.has_key(zone): groups[zone].append(name)
else: groups[zone] = [name]
@ -259,6 +264,9 @@ class GceInventory(object):
stat = 'status_%s' % status.lower()
if groups.has_key(stat): groups[stat].append(name)
else: groups[stat] = [name]
groups["_meta"] = meta
return groups
def json_format_dict(self, data, pretty=False):