- os_list = backend.DiagnoseOS()
- if not os_list:
- # this catches also return values of 'False',
- # for which we can't iterate over
- return os_list
- result = []
- for data in os_list:
- if isinstance(data, objects.OS):
- result.append(data.ToDict())
- elif isinstance(data, errors.InvalidOS):
- result.append(data.args)
- else:
- raise errors.ProgrammerError("Invalid result from backend.DiagnoseOS"
- " (class %s, %s)" %
- (str(data.__class__), data))
-
- return result