<s> """<STR_LIT>""" <EOL> from ganeti import constants <EOL> ECODE_RESOLVER = constants . ERRORS_ECODE_RESOLVER <EOL> ECODE_NORES = constants . ERRORS_ECODE_NORES <EOL> ECODE_TEMP_NORES = constants . ERRORS_ECODE_TEMP_NORES <EOL> ECODE_INVAL = constants . ERRORS_ECODE_INVAL <EOL> ECODE_STATE = constants . ERRORS_ECODE_STATE <EOL> ECODE_NOENT = constants . ERRORS_ECODE_NOENT <EOL> ECODE_EXISTS = constants . ERRORS_ECODE_EXISTS <EOL> ECODE_NOTUNIQUE = constants . ERRORS_ECODE_NOTUNIQUE <EOL> ECODE_FAULT = constants . ERRORS_ECODE_FAULT <EOL> ECODE_ENVIRON = constants . ERRORS_ECODE_ENVIRON <EOL> ECODE_ALL = constants . ERRORS_ECODE_ALL <EOL> class GenericError ( Exception ) : <EOL> """<STR_LIT>""" <EOL> class LockError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class PidFileLockError ( LockError ) : <EOL> """<STR_LIT>""" <EOL> class HypervisorError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class HotplugError ( HypervisorError ) : <EOL> """<STR_LIT>""" <EOL> class ProgrammerError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class BlockDeviceError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class ConfigurationError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class ConfigVersionMismatch ( ConfigurationError ) : <EOL> """<STR_LIT>""" <EOL> class ConfigVerifyError ( ConfigurationError ) : <EOL> """<STR_LIT>""" <EOL> class AddressPoolError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class ReservationError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class RemoteError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class SignatureError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class ParameterError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class ResultValidationError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class OpPrereqError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class OpExecError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class OpResultError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class OpRetryNotSupportedError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class DeviceCreationError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , message , created_devices ) : <EOL> GenericError . __init__ ( self ) <EOL> self . message = message <EOL> self . created_devices = created_devices <EOL> def __str__ ( self ) : <EOL> return self . message <EOL> class OpCodeUnknown ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class JobLost ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class JobFileCorrupted ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class ResolverError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class HooksFailure ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class HooksAbort ( HooksFailure ) : <EOL> """<STR_LIT>""" <EOL> class UnitParseError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class ParseError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class TypeEnforcementError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class X509CertError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class TagError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class CommandError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class StorageError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class InotifyError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class QuitGanetiException ( Exception ) : <EOL> """<STR_LIT>""" <EOL> class JobQueueError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class JobQueueDrainError ( JobQueueError ) : <EOL> """<STR_LIT>""" <EOL> class JobQueueFull ( JobQueueError ) : <EOL> """<STR_LIT>""" <EOL> class ConfdMagicError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class ConfdClientError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class UdpDataSizeError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class NoCtypesError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class IPAddressError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class LuxiError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class QueryFilterParseError ( ParseError ) : <EOL> """<STR_LIT>""" <EOL> def GetDetails ( self ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> ( _ , inner ) = self . args <EOL> except IndexError : <EOL> return None <EOL> return [ str ( inner . line ) , <EOL> ( "<STR_LIT:U+0020>" * ( inner . column - <NUM_LIT:1> ) ) + "<STR_LIT>" , <EOL> str ( inner ) ] <EOL> class RapiTestResult ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class FileStoragePathError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class SshUpdateError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> class PamRapiAuthError ( GenericError ) : <EOL> """<STR_LIT>""" <EOL> def GetErrorClass ( name ) : <EOL> """<STR_LIT>""" <EOL> item = globals ( ) . get ( name , None ) <EOL> if item is not None : <EOL> if not ( isinstance ( item , type ( Exception ) ) and <EOL> issubclass ( item , GenericError ) ) : <EOL> item = None <EOL> return item <EOL> def EncodeException ( err ) : <EOL> """<STR_LIT>""" <EOL> return ( err . __class__ . __name__ , err . args ) <EOL> def GetEncodedError ( result ) : <EOL> """<STR_LIT>""" <EOL> tlt = ( tuple , list ) <EOL> if ( isinstance ( result , tlt ) and len ( result ) == <NUM_LIT:2> and <EOL> isinstance ( result [ <NUM_LIT:1> ] , tlt ) ) : <EOL> errcls = GetErrorClass ( result [ <NUM_LIT:0> ] ) <EOL> if errcls : <EOL> return ( errcls , tuple ( result [ <NUM_LIT:1> ] ) ) <EOL> return None <EOL> def MaybeRaise ( result ) : <EOL> """<STR_LIT>""" <EOL> error = GetEncodedError ( result ) <EOL> if error : <EOL> ( errcls , args ) = error <EOL> raise errcls ( * args ) </s>
