From 083530d8faf00c84b49c3a5cff15d5d9706d4076 Mon Sep 17 00:00:00 2001 From: Andre keedy Date: Wed, 3 Feb 2016 17:00:58 -0500 Subject: [PATCH] Fix erros --- contrib/inventory/rackhd.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/contrib/inventory/rackhd.py b/contrib/inventory/rackhd.py index f27fd5905e..df74eb332b 100755 --- a/contrib/inventory/rackhd.py +++ b/contrib/inventory/rackhd.py @@ -5,9 +5,9 @@ import os import argparse import types -MONORAIL_URL = 'http://localhost:8080' +RACKHD_URL = 'http://localhost:8080' -class OnRackInventory(object): +class RackhdInventory(object): def __init__(self, nodeids): self._inventory = {} for nodeid in nodeids: @@ -18,12 +18,12 @@ class OnRackInventory(object): output += ',\n' output = output[:-2] output += '}\n' - print output + print (output) def _load_inventory_data(self, nodeid): info = {} - info['ohai'] = MONORAIL_URL + '/api/common/nodes/{0}/catalogs/ohai'.format(nodeid ) - info['lookup'] = MONORAIL_URL + '/api/common/lookups/?q={0}'.format(nodeid) + info['ohai'] = RACKHD_URL + '/api/common/nodes/{0}/catalogs/ohai'.format(nodeid ) + info['lookup'] = RACKHD_URL + '/api/common/lookups/?q={0}'.format(nodeid) results = {} for key,url in info.iteritems(): @@ -52,8 +52,8 @@ class OnRackInventory(object): return output try: - #check if monorail url(ie:10.1.1.45:8080) is specified in the environment - MONORAIL_URL = 'http://' + str(os.environ['MONORAIL']) + #check if rackhd url(ie:10.1.1.45:8080) is specified in the environment + RACKHD_URL = 'http://' + str(os.environ['RACKHD_URL']) except: #use default values pass @@ -64,10 +64,10 @@ nodeids = [] try: nodeids += os.environ['nodeid'].split(',') except KeyError: - url = MONORAIL_URL + '/api/common/nodes' + url = RACKHD_URL + '/api/common/nodes' r = requests.get( url, verify=False) data = json.loads(r.text) for entry in data: if entry['type'] == 'compute': nodeids.append(entry['id']) -OnRackInventory(nodeids) +RackhdInventory(nodeids)