-def _DiagnoseOSValid(obj):
- """Verify whether an OS diagnose object represents a valid OS
-
- Args:
- obj: an diagnostic object as returned by OpDiagnoseOS
-
- Returns:
- bool: OS validity status
- """
-
- if isinstance(obj, objects.OS):
- return True
- elif isinstance(obj, errors.InvalidOS):
- return False
- else:
- raise errors.ProgrammerError('unknown OS diagnose type')
-
-def _DiagnoseOSStatus(obj):
- """Generate a status message for an OS diagnose object.
-
- Args:
- obj: an diagnostic object as returned by OpDiagnoseOS
-
- Returns:
- string: a description of the OS status
- """
-
- if _DiagnoseOSValid(obj):
- return "valid (path: %s)" % obj.path
- else:
- return "%s (path: %s)" % (obj.args[2], obj.args[1])