summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAndre Keedy <andre.keedy@emc.com>2016-03-14 16:26:52 -0400
committerAndre Keedy <andre.keedy@emc.com>2016-03-14 16:40:39 -0400
commitd180e0e05ff52d03aa6c758e35b4111a2cdd3ac9 (patch)
tree5026273691200704caf4825f2ba45e703c0c8a61 /contrib
parent2984ffdfac845290c8a89802b6308ae5b130a36a (diff)
downloadansible-d180e0e05ff52d03aa6c758e35b4111a2cdd3ac9.tar.gz
Bug Fix
-Corrected the format in case of multiple hosts Remove empty spaces
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/inventory/rackhd.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/inventory/rackhd.py b/contrib/inventory/rackhd.py
index e7db24d320..92abc4d6a6 100755
--- a/contrib/inventory/rackhd.py
+++ b/contrib/inventory/rackhd.py
@@ -13,8 +13,10 @@ class RackhdInventory(object):
self._inventory = {}
for nodeid in nodeids:
self._load_inventory_data(nodeid)
+ inventory = {}
for nodeid,info in self._inventory.iteritems():
- print(json.dumps(self._format_output(nodeid, info)))
+ inventory[nodeid]= (self._format_output(nodeid, info))
+ print(json.dumps(inventory))
def _load_inventory_data(self, nodeid):
info = {}
@@ -33,10 +35,10 @@ class RackhdInventory(object):
ipaddress = ''
if len(node_info) > 0:
ipaddress = node_info[0]['ipAddress']
- output = {nodeid:{ 'hosts':[ipaddress],'vars':{}}}
+ output = { 'hosts':[ipaddress],'vars':{}}
for key,result in info.iteritems():
- output[nodeid]['vars'][key] = json.loads(result)
- output[nodeid]['vars']['ansible_ssh_user'] = 'monorail'
+ output['vars'][key] = json.loads(result)
+ output['vars']['ansible_ssh_user'] = 'monorail'
except KeyError:
pass
return output