Revision d2c807e4

b/lib/objects.py
597 597
    "rename_script",
598 598
    ]
599 599

  
600
  @classmethod
601
  def FromInvalidOS(cls, err):
602
    """Create an OS from an InvalidOS error.
603

  
604
    This routine knows how to convert an InvalidOS error to an OS
605
    object representing the broken OS with a meaningful error message.
606

  
607
    """
608
    if not isinstance(err, errors.InvalidOS):
609
      raise errors.ProgrammerError("Trying to initialize an OS from an"
610
                                   " invalid object of type %s" % type(err))
611

  
612
    return cls(name=err.args[0], path=err.args[1], status=err.args[2])
613

  
600 614
  def __nonzero__(self):
601 615
    return self.status == constants.OS_VALID_STATUS
602 616

  

Also available in: Unified diff