<s> import sahara . exceptions as e <EOL> from sahara . i18n import _ <EOL> class NodeGroupCannotBeScaled ( e . SaharaException ) : <EOL> def __init__ ( self , ng_name , reason ) : <EOL> self . message = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) % { "<STR_LIT>" : ng_name , "<STR_LIT>" : reason } <EOL> self . code = "<STR_LIT>" <EOL> super ( NodeGroupCannotBeScaled , self ) . __init__ ( ) <EOL> class DecommissionError ( e . SaharaException ) : <EOL> code = "<STR_LIT>" <EOL> message = _ ( "<STR_LIT>" ) <EOL> def __init__ ( self , message = None ) : <EOL> if message : <EOL> self . message = message <EOL> super ( DecommissionError , self ) . __init__ ( ) <EOL> class ClusterCannotBeScaled ( e . SaharaException ) : <EOL> def __init__ ( self , cluster_name , reason ) : <EOL> self . message = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) % { "<STR_LIT>" : cluster_name , <EOL> "<STR_LIT>" : reason } <EOL> self . code = "<STR_LIT>" <EOL> super ( ClusterCannotBeScaled , self ) . __init__ ( ) <EOL> class RequiredServiceMissingException ( e . SaharaException ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , service_name , required_by = None ) : <EOL> self . message = ( _ ( '<STR_LIT>' ) <EOL> % service_name ) <EOL> if required_by : <EOL> self . message = ( _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> % { '<STR_LIT:message>' : self . message , <EOL> '<STR_LIT>' : required_by } ) <EOL> self . code = '<STR_LIT>' <EOL> super ( RequiredServiceMissingException , self ) . __init__ ( ) <EOL> class InvalidComponentCountException ( e . SaharaException ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , component , expected_count , count , description = None ) : <EOL> message = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if description : <EOL> message = ( "<STR_LIT>" <EOL> % { '<STR_LIT:message>' : message , '<STR_LIT:description>' : description } ) <EOL> self . message = message % { "<STR_LIT>" : expected_count , <EOL> "<STR_LIT>" : component , "<STR_LIT:count>" : count } <EOL> self . code = "<STR_LIT>" <EOL> super ( InvalidComponentCountException , self ) . __init__ ( ) <EOL> class InvalidClusterTopology ( e . SaharaException ) : <EOL> """<STR_LIT>""" <EOL> code = "<STR_LIT>" <EOL> message = _ ( "<STR_LIT>" ) <EOL> def __init__ ( self , description ) : <EOL> self . message = self . message . format ( description = description ) <EOL> super ( InvalidClusterTopology , self ) . __init__ ( ) <EOL> class HadoopProvisionError ( e . SaharaException ) : <EOL> """<STR_LIT>""" <EOL> base_message = _ ( "<STR_LIT>" ) <EOL> def __init__ ( self , message ) : <EOL> self . code = "<STR_LIT>" <EOL> self . message = self . base_message % message <EOL> super ( HadoopProvisionError , self ) . __init__ ( ) <EOL> class NameNodeHAConfigurationError ( e . SaharaException ) : <EOL> """<STR_LIT>""" <EOL> base_message = _ ( "<STR_LIT>" ) <EOL> def __init__ ( self , message ) : <EOL> self . code = "<STR_LIT>" <EOL> self . message = self . base_message % message <EOL> super ( NameNodeHAConfigurationError , self ) . __init__ ( ) <EOL> class ResourceManagerHAConfigurationError ( e . SaharaException ) : <EOL> """<STR_LIT>""" <EOL> base_message = _ ( "<STR_LIT>" ) <EOL> def __init__ ( self , message ) : <EOL> self . code = "<STR_LIT>" <EOL> self . message = self . base_message % message <EOL> super ( ResourceManagerHAConfigurationError , self ) . __init__ ( ) <EOL> class ImageValidationSpecificationError ( e . SaharaException ) : <EOL> """<STR_LIT>""" <EOL> base_message = _ ( "<STR_LIT>" ) <EOL> def __init__ ( self , message , * args ) : <EOL> self . code = "<STR_LIT>" <EOL> self . message = self . base_message % message <EOL> super ( ImageValidationSpecificationError , self ) . __init__ ( ) <EOL> class ImageValidationError ( e . SaharaException ) : <EOL> """<STR_LIT>""" <EOL> base_message = _ ( "<STR_LIT>" ) <EOL> def __init__ ( self , message ) : <EOL> self . code = "<STR_LIT>" <EOL> self . message = self . base_message % message <EOL> super ( ImageValidationError , self ) . __init__ ( ) <EOL> class AllValidationsFailedError ( ImageValidationError ) : <EOL> """<STR_LIT>""" <EOL> sub_message = _ ( "<STR_LIT>" ) <EOL> def __init__ ( self , exceptions ) : <EOL> data = "<STR_LIT:;>" . join ( ex . message for ex in exceptions ) <EOL> message = self . sub_message % data <EOL> super ( AllValidationsFailedError , self ) . __init__ ( message ) </s>
