<s> from sahara . i18n import _ <EOL> from sahara . plugins . cdh . v5_3_0 import plugin_utils as pu <EOL> from sahara . plugins . cdh import validation <EOL> from sahara . plugins import exceptions as ex <EOL> from sahara . plugins import utils as u <EOL> class ValidatorV530 ( validation . Validator ) : <EOL> PU = pu . PluginUtilsV530 ( ) <EOL> @ classmethod <EOL> def validate_cluster_creating ( cls , cluster ) : <EOL> super ( ValidatorV530 , cls ) . validate_cluster_creating ( cluster ) <EOL> cls . _flume_validation ( cluster ) <EOL> cls . _sentry_validation ( cluster ) <EOL> cls . _solr_validation ( cluster ) <EOL> cls . _sqoop_validation ( cluster ) <EOL> cls . _hbase_indexer_validation ( cluster ) <EOL> cls . _impala_validation ( cluster ) <EOL> @ classmethod <EOL> def _flume_validation ( cls , cluster ) : <EOL> a_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> dn_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> if a_count >= <NUM_LIT:1> : <EOL> if dn_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> @ classmethod <EOL> def _sentry_validation ( cls , cluster ) : <EOL> snt_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> dn_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> zk_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> if snt_count > <NUM_LIT:1> : <EOL> raise ex . InvalidComponentCountException ( <EOL> '<STR_LIT>' , _ ( '<STR_LIT>' ) , snt_count ) <EOL> if snt_count == <NUM_LIT:1> : <EOL> if dn_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if zk_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> @ classmethod <EOL> def _solr_validation ( cls , cluster ) : <EOL> slr_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> zk_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> dn_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> if slr_count >= <NUM_LIT:1> : <EOL> if dn_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if zk_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> @ classmethod <EOL> def _sqoop_validation ( cls , cluster ) : <EOL> s2s_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> dn_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> hs_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> nm_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> if s2s_count > <NUM_LIT:1> : <EOL> raise ex . InvalidComponentCountException ( <EOL> '<STR_LIT>' , _ ( '<STR_LIT>' ) , s2s_count ) <EOL> if s2s_count == <NUM_LIT:1> : <EOL> if dn_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if nm_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if hs_count != <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> @ classmethod <EOL> def _hbase_indexer_validation ( cls , cluster ) : <EOL> lhbi_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> zk_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> dn_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> slr_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> hbm_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> if lhbi_count >= <NUM_LIT:1> : <EOL> if dn_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if zk_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if slr_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if hbm_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> @ classmethod <EOL> def _impala_validation ( cls , cluster ) : <EOL> ics_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> iss_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> id_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> dn_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> hms_count = cls . _get_inst_count ( cluster , '<STR_LIT>' ) <EOL> if ics_count > <NUM_LIT:1> : <EOL> raise ex . InvalidComponentCountException ( '<STR_LIT>' , <EOL> _ ( '<STR_LIT>' ) , ics_count ) <EOL> if iss_count > <NUM_LIT:1> : <EOL> raise ex . InvalidComponentCountException ( '<STR_LIT>' , <EOL> _ ( '<STR_LIT>' ) , iss_count ) <EOL> if ics_count == <NUM_LIT:1> : <EOL> datanode_ng = u . get_node_groups ( cluster , "<STR_LIT>" ) <EOL> impalad_ng = u . get_node_groups ( cluster , "<STR_LIT>" ) <EOL> datanodes = set ( ng . id for ng in datanode_ng ) <EOL> impalads = set ( ng . id for ng in impalad_ng ) <EOL> if datanodes != impalads : <EOL> raise ex . InvalidClusterTopology ( <EOL> _ ( "<STR_LIT>" ) ) <EOL> if iss_count != <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if id_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if dn_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) <EOL> if hms_count < <NUM_LIT:1> : <EOL> raise ex . RequiredServiceMissingException ( <EOL> '<STR_LIT>' , required_by = '<STR_LIT>' ) </s>
