Skip to content
Snippets Groups Projects
Commit a2656173 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Make “gnt-os diagnose” exit 1 if not all OSes are valid.

Reviewed-by: iustinp
parent d7e49c13
No related branches found
No related tags found
No related merge requests found
......@@ -174,6 +174,8 @@ def DiagnoseOS(opts, args):
logger.ToStdout(format % (max_name, 'Name', max_node, 'Status/Node',
'Details'))
has_bad = False
for os_name in all_os:
nodes_valid = {}
nodes_bad = {}
......@@ -192,8 +194,10 @@ def DiagnoseOS(opts, args):
status = "valid"
elif not nodes_valid and nodes_bad:
status = "invalid"
has_bad = True
else:
status = "partial valid"
has_bad = True
def _OutputNodeHiddenOSStatus(dobj_list):
for dobj in dobj_list:
......@@ -213,6 +217,8 @@ def DiagnoseOS(opts, args):
_OutputPerNodeOSStatus(nodes_valid)
_OutputPerNodeOSStatus(nodes_bad)
return int(has_bad)
commands = {
'list': (ListOS, ARGS_NONE, [DEBUG_OPT, NOHDR_OPT], "",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment