Merge "[API] Nodes get KeyError: 'Members'"

This commit is contained in:
Jenkins 2016-10-19 06:25:36 +00:00 committed by Gerrit Code Review
commit fad73d727e

View File

@ -159,7 +159,10 @@ def urls2list(url):
# This will extract the url values from @odata.id inside Members
resp = send_request(url)
respdata = resp.json()
return [u['@odata.id'] for u in respdata['Members']]
if 'Members' in respdata:
return [u['@odata.id'] for u in respdata['Members']]
else:
return []
def extract_val(data, path):
@ -397,7 +400,8 @@ def nodes_list(count=None, filters={}):
if "Memory" in node:
ram = node["Memory"]["TotalSystemMemoryGiB"]
if "EthernetInterfaces" in node["Links"]:
if "EthernetInterfaces" in node["Links"] and node[
"Links"]["EthernetInterfaces"]:
nw = len(node["Links"]["EthernetInterfaces"])
bmcip = "127.0.0.1" # system['Oem']['Dell_G5MC']['BmcIp']