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

Convert ListOS to use the all helper function.

The predicate function gets build by a lambda function.
Also add a bit of debugging information to the 'unknown OS diagnose type'.

Reviewed-by: iustinp
parent 78feb6fb
......@@ -45,7 +45,7 @@ def _DiagnoseOSValid(obj):
elif isinstance(obj, errors.InvalidOS):
return False
raise errors.ProgrammerError('unknown OS diagnose type')
raise errors.ProgrammerError("unknown OS diagnose type: '%s'" % type(obj))
def _DiagnoseOSName(obj):
......@@ -126,12 +126,8 @@ def ListOS(opts, args):
for os_name, os_node_data in all_os.iteritems():
if len(os_node_data) != num_nodes:
valid = True
for l in os_node_data.values():
if not _DiagnoseOSValid(l[0]):
valid = False
if valid:
if utils.all(os_node_data.values(), lambda l: _DiagnoseOSValid(l[0])):
if not opts.no_headers:
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