Commit 95952011 by David Kirchner

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

parent bdf3ec1e
...@@ -229,9 +229,14 @@ class GceInventory(object): ...@@ -229,9 +229,14 @@ class GceInventory(object):
def group_instances(self): def group_instances(self):
'''Group all instances''' '''Group all instances'''
groups = {} groups = {}
meta = {}
meta["hostvars"] = {}
for node in self.driver.list_nodes(): for node in self.driver.list_nodes():
name = node.name name = node.name
meta["hostvars"][name] = self.node_to_dict(node)
zone = node.extra['zone'].name zone = node.extra['zone'].name
if groups.has_key(zone): groups[zone].append(name) if groups.has_key(zone): groups[zone].append(name)
else: groups[zone] = [name] else: groups[zone] = [name]
...@@ -259,6 +264,9 @@ class GceInventory(object): ...@@ -259,6 +264,9 @@ class GceInventory(object):
stat = 'status_%s' % status.lower() stat = 'status_%s' % status.lower()
if groups.has_key(stat): groups[stat].append(name) if groups.has_key(stat): groups[stat].append(name)
else: groups[stat] = [name] else: groups[stat] = [name]
groups["_meta"] = meta
return groups return groups
def json_format_dict(self, data, pretty=False): def json_format_dict(self, data, pretty=False):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment