Commit ba00557a authored by Guido Trotter's avatar Guido Trotter
Browse files

Add per-node variants list to OS diagnose output


Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent 6ee7102a
......@@ -1633,12 +1633,13 @@ def DiagnoseOS(top_dirs=None):
search (if not given defaults to
L{constants.OS_SEARCH_PATH})
@rtype: list of L{objects.OS}
@return: a list of tuples (name, path, status, diagnose)
@return: a list of tuples (name, path, status, diagnose, variants)
for all (potential) OSes under all search paths, where:
- name is the (potential) OS name
- path is the full path to the OS
- status True/False is the validity of the OS
- diagnose is the error message for an invalid OS, otherwise empty
- variants is a list of supported OS variants, if any
"""
if top_dirs is None:
......@@ -1657,9 +1658,11 @@ def DiagnoseOS(top_dirs=None):
status, os_inst = _TryOSFromDisk(name, base_dir=dir_name)
if status:
diagnose = ""
variants = os_inst.supported_variants
else:
diagnose = os_inst
result.append((name, os_path, status, diagnose))
variants = []
result.append((name, os_path, status, diagnose, variants))
return result
......
......@@ -2193,14 +2193,14 @@ class LUDiagnoseOS(NoHooksLU):
for node_name, nr in rlist.items():
if nr.fail_msg or not nr.payload:
continue
for name, path, status, diagnose in nr.payload:
for name, path, status, diagnose, variants in nr.payload:
if name not in all_os:
# build a list of nodes for this os containing empty lists
# for each node in node_list
all_os[name] = {}
for nname in good_nodes:
all_os[name][nname] = []
all_os[name][node_name].append((path, status, diagnose))
all_os[name][node_name].append((path, status, diagnose, variants))
return all_os
def Exec(self, feedback_fn):
......
......@@ -106,10 +106,13 @@ def DiagnoseOS(opts, args):
for node_name, node_info in node_data.iteritems():
nodes_hidden[node_name] = []
if node_info: # at least one entry in the per-node list
first_os_path, first_os_status, first_os_msg = node_info.pop(0)
first_os_msg = ("%s (path: %s)" % (_OsStatus(first_os_status,
first_os_msg),
first_os_path))
(first_os_path, first_os_status, first_os_msg,
first_os_variants) = node_info.pop(0)
if not first_os_variants:
first_os_variants = []
first_os_msg = ("%s (path: %s) [variants: %s]" %
(_OsStatus(first_os_status, first_os_msg),
first_os_path, ', '.join(first_os_variants)))
if first_os_status:
nodes_valid[node_name] = first_os_msg
else:
......
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