Commit 25d148c2 authored by Paul Rich's avatar Paul Rich
Browse files

Merge branch '95-fix-capmc-get-ssd-sim-fix' into 'develop'

Fixing an issue where the test environment didn't match reality.

Closes #95

See merge request !50
parents 5c1ac88b 07c60412
......@@ -190,12 +190,13 @@ def extract_system_node_data(node_data):
return ret_nodeinfo
def fetch_ssd_static_data(nid_list=None, by_cname=False):
def fetch_ssd_static_data(nid_list=None, raw=False):
'''Get static SSD information from CAPMC.
Args:
nid_list - optional list of nodes as a comma-delimited, hyphenated string (default None).
by_cname - if True, returns the nodes keyed by Cray cname (default False
raw - If True returns raw json dict. If False, adds nid indexing (default False)
Returns:
A dictionary with call status, Consult CAPMC documentation for details
......@@ -207,17 +208,16 @@ def fetch_ssd_static_data(nid_list=None, by_cname=False):
if nid_list is not None:
args.extend(['-n', nid_list])
ret_info = _call_sys_forker_capmc(CAPMC_PATH, args)
if not by_cname:
if not raw:
# Because everything else in this system works on nids.
fixed_ret_info = {}
fixed_ret_info = {'e': ret_info['e'],
'err_msg': ret_info['err_msg']}
fixed_ret_info['nids'] = []
for key, val in ret_info.items():
if key not in ['e', 'err_msg']:
fixed_val = val
val['cname'] = key
fixed_ret_info['nids'].append(fixed_val)
else:
fixed_ret_info[key] = val
for ssd_info in val: # This is a list of SSDs potentially
fixed_ret_info['nids'].append(ssd_info)
ret_info = fixed_ret_info
return ret_info
......
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