Fix strange check in code
Check like "if ${process} not in [0, 1]" has been used in code, they should be changed to "if ${process} > 1" Change-Id: If7606d1da58a1e962035051c9538e8df925422c1
This commit is contained in:
parent
882328204c
commit
d3d119e8d6
@ -38,12 +38,12 @@ def validate_cluster_creating(cluster):
|
|||||||
snn_count)
|
snn_count)
|
||||||
|
|
||||||
rm_count = _get_inst_count(cluster, 'YARN_RESOURCEMANAGER')
|
rm_count = _get_inst_count(cluster, 'YARN_RESOURCEMANAGER')
|
||||||
if rm_count not in [0, 1]:
|
if rm_count > 1:
|
||||||
raise ex.InvalidComponentCountException('YARN_RESOURCEMANAGER',
|
raise ex.InvalidComponentCountException('YARN_RESOURCEMANAGER',
|
||||||
_('0 or 1'), rm_count)
|
_('0 or 1'), rm_count)
|
||||||
|
|
||||||
hs_count = _get_inst_count(cluster, 'YARN_JOBHISTORY')
|
hs_count = _get_inst_count(cluster, 'YARN_JOBHISTORY')
|
||||||
if hs_count not in [0, 1]:
|
if hs_count > 1:
|
||||||
raise ex.InvalidComponentCountException('YARN_JOBHISTORY', _('0 or 1'),
|
raise ex.InvalidComponentCountException('YARN_JOBHISTORY', _('0 or 1'),
|
||||||
hs_count)
|
hs_count)
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ def validate_cluster_creating(cluster):
|
|||||||
|
|
||||||
oo_count = _get_inst_count(cluster, 'OOZIE_SERVER')
|
oo_count = _get_inst_count(cluster, 'OOZIE_SERVER')
|
||||||
dn_count = _get_inst_count(cluster, 'HDFS_DATANODE')
|
dn_count = _get_inst_count(cluster, 'HDFS_DATANODE')
|
||||||
if oo_count not in [0, 1]:
|
if oo_count > 1:
|
||||||
raise ex.InvalidComponentCountException('OOZIE_SERVER', _('0 or 1'),
|
raise ex.InvalidComponentCountException('OOZIE_SERVER', _('0 or 1'),
|
||||||
oo_count)
|
oo_count)
|
||||||
|
|
||||||
@ -97,12 +97,12 @@ def validate_cluster_creating(cluster):
|
|||||||
'HIVE_METASTORE', required_by='WEBHCAT')
|
'HIVE_METASTORE', required_by='WEBHCAT')
|
||||||
|
|
||||||
hue_count = _get_inst_count(cluster, 'HUE_SERVER')
|
hue_count = _get_inst_count(cluster, 'HUE_SERVER')
|
||||||
if hue_count not in [0, 1]:
|
if hue_count > 1:
|
||||||
raise ex.InvalidComponentCountException('HUE_SERVER', _('0 or 1'),
|
raise ex.InvalidComponentCountException('HUE_SERVER', _('0 or 1'),
|
||||||
hue_count)
|
hue_count)
|
||||||
|
|
||||||
shs_count = _get_inst_count(cluster, 'SPARK_YARN_HISTORY_SERVER')
|
shs_count = _get_inst_count(cluster, 'SPARK_YARN_HISTORY_SERVER')
|
||||||
if shs_count not in [0, 1]:
|
if shs_count > 1:
|
||||||
raise ex.InvalidComponentCountException('SPARK_YARN_HISTORY_SERVER',
|
raise ex.InvalidComponentCountException('SPARK_YARN_HISTORY_SERVER',
|
||||||
_('0 or 1'), shs_count)
|
_('0 or 1'), shs_count)
|
||||||
if shs_count and not rm_count:
|
if shs_count and not rm_count:
|
||||||
|
@ -38,12 +38,12 @@ def validate_cluster_creating(cluster):
|
|||||||
snn_count)
|
snn_count)
|
||||||
|
|
||||||
rm_count = _get_inst_count(cluster, 'YARN_RESOURCEMANAGER')
|
rm_count = _get_inst_count(cluster, 'YARN_RESOURCEMANAGER')
|
||||||
if rm_count not in [0, 1]:
|
if rm_count > 1:
|
||||||
raise ex.InvalidComponentCountException('YARN_RESOURCEMANAGER',
|
raise ex.InvalidComponentCountException('YARN_RESOURCEMANAGER',
|
||||||
_('0 or 1'), rm_count)
|
_('0 or 1'), rm_count)
|
||||||
|
|
||||||
hs_count = _get_inst_count(cluster, 'YARN_JOBHISTORY')
|
hs_count = _get_inst_count(cluster, 'YARN_JOBHISTORY')
|
||||||
if hs_count not in [0, 1]:
|
if hs_count > 1:
|
||||||
raise ex.InvalidComponentCountException('YARN_JOBHISTORY',
|
raise ex.InvalidComponentCountException('YARN_JOBHISTORY',
|
||||||
_('0 or 1'), hs_count)
|
_('0 or 1'), hs_count)
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ def validate_cluster_creating(cluster):
|
|||||||
|
|
||||||
oo_count = _get_inst_count(cluster, 'OOZIE_SERVER')
|
oo_count = _get_inst_count(cluster, 'OOZIE_SERVER')
|
||||||
dn_count = _get_inst_count(cluster, 'HDFS_DATANODE')
|
dn_count = _get_inst_count(cluster, 'HDFS_DATANODE')
|
||||||
if oo_count not in [0, 1]:
|
if oo_count > 1:
|
||||||
raise ex.InvalidComponentCountException('OOZIE_SERVER', _('0 or 1'),
|
raise ex.InvalidComponentCountException('OOZIE_SERVER', _('0 or 1'),
|
||||||
oo_count)
|
oo_count)
|
||||||
|
|
||||||
@ -97,12 +97,12 @@ def validate_cluster_creating(cluster):
|
|||||||
'HIVE_METASTORE', required_by='HIVE_WEBHCAT')
|
'HIVE_METASTORE', required_by='HIVE_WEBHCAT')
|
||||||
|
|
||||||
hue_count = _get_inst_count(cluster, 'HUE_SERVER')
|
hue_count = _get_inst_count(cluster, 'HUE_SERVER')
|
||||||
if hue_count not in [0, 1]:
|
if hue_count > 1:
|
||||||
raise ex.InvalidComponentCountException('HUE_SERVER', _('0 or 1'),
|
raise ex.InvalidComponentCountException('HUE_SERVER', _('0 or 1'),
|
||||||
hue_count)
|
hue_count)
|
||||||
|
|
||||||
shs_count = _get_inst_count(cluster, 'SPARK_YARN_HISTORY_SERVER')
|
shs_count = _get_inst_count(cluster, 'SPARK_YARN_HISTORY_SERVER')
|
||||||
if shs_count not in [0, 1]:
|
if shs_count > 1:
|
||||||
raise ex.InvalidComponentCountException('SPARK_YARN_HISTORY_SERVER',
|
raise ex.InvalidComponentCountException('SPARK_YARN_HISTORY_SERVER',
|
||||||
_('0 or 1'), shs_count)
|
_('0 or 1'), shs_count)
|
||||||
if shs_count and not rm_count:
|
if shs_count and not rm_count:
|
||||||
@ -139,7 +139,7 @@ def validate_cluster_creating(cluster):
|
|||||||
'HDFS_DATANODE', required_by='FLUME_AGENT')
|
'HDFS_DATANODE', required_by='FLUME_AGENT')
|
||||||
|
|
||||||
snt_count = _get_inst_count(cluster, 'SENTRY_SERVER')
|
snt_count = _get_inst_count(cluster, 'SENTRY_SERVER')
|
||||||
if snt_count not in [0, 1]:
|
if snt_count > 1:
|
||||||
raise ex.InvalidComponentCountException('SENTRY_SERVER', _('0 or 1'),
|
raise ex.InvalidComponentCountException('SENTRY_SERVER', _('0 or 1'),
|
||||||
snt_count)
|
snt_count)
|
||||||
if snt_count == 1:
|
if snt_count == 1:
|
||||||
@ -160,7 +160,7 @@ def validate_cluster_creating(cluster):
|
|||||||
'ZOOKEEPER', required_by='SOLR_SERVER')
|
'ZOOKEEPER', required_by='SOLR_SERVER')
|
||||||
|
|
||||||
s2s_count = _get_inst_count(cluster, 'SQOOP_SERVER')
|
s2s_count = _get_inst_count(cluster, 'SQOOP_SERVER')
|
||||||
if s2s_count not in [0, 1]:
|
if s2s_count > 1:
|
||||||
raise ex.InvalidComponentCountException('SQOOP_SERVER', _('0 or 1'),
|
raise ex.InvalidComponentCountException('SQOOP_SERVER', _('0 or 1'),
|
||||||
s2s_count)
|
s2s_count)
|
||||||
if s2s_count == 1:
|
if s2s_count == 1:
|
||||||
@ -192,10 +192,10 @@ def validate_cluster_creating(cluster):
|
|||||||
ics_count = _get_inst_count(cluster, 'IMPALA_CATALOGSERVER')
|
ics_count = _get_inst_count(cluster, 'IMPALA_CATALOGSERVER')
|
||||||
iss_count = _get_inst_count(cluster, 'IMPALA_STATESTORE')
|
iss_count = _get_inst_count(cluster, 'IMPALA_STATESTORE')
|
||||||
id_count = _get_inst_count(cluster, 'IMPALAD')
|
id_count = _get_inst_count(cluster, 'IMPALAD')
|
||||||
if ics_count not in [0, 1]:
|
if ics_count > 1:
|
||||||
raise ex.InvalidComponentCountException('IMPALA_CATALOGSERVER',
|
raise ex.InvalidComponentCountException('IMPALA_CATALOGSERVER',
|
||||||
_('0 or 1'), ics_count)
|
_('0 or 1'), ics_count)
|
||||||
if iss_count not in [0, 1]:
|
if iss_count > 1:
|
||||||
raise ex.InvalidComponentCountException('IMPALA_STATESTORE',
|
raise ex.InvalidComponentCountException('IMPALA_STATESTORE',
|
||||||
_('0 or 1'), iss_count)
|
_('0 or 1'), iss_count)
|
||||||
if ics_count == 1:
|
if ics_count == 1:
|
||||||
|
@ -27,17 +27,17 @@ def validate_cluster_creating(pctx, cluster):
|
|||||||
raise ex.InvalidComponentCountException('namenode', 1, nn_count)
|
raise ex.InvalidComponentCountException('namenode', 1, nn_count)
|
||||||
|
|
||||||
snn_count = _get_inst_count(cluster, 'secondarynamenode')
|
snn_count = _get_inst_count(cluster, 'secondarynamenode')
|
||||||
if snn_count not in [0, 1]:
|
if snn_count > 1:
|
||||||
raise ex.InvalidComponentCountException('secondarynamenode',
|
raise ex.InvalidComponentCountException('secondarynamenode',
|
||||||
_('0 or 1'), snn_count)
|
_('0 or 1'), snn_count)
|
||||||
|
|
||||||
rm_count = _get_inst_count(cluster, 'resourcemanager')
|
rm_count = _get_inst_count(cluster, 'resourcemanager')
|
||||||
if rm_count not in [0, 1]:
|
if rm_count > 1:
|
||||||
raise ex.InvalidComponentCountException('resourcemanager', _('0 or 1'),
|
raise ex.InvalidComponentCountException('resourcemanager', _('0 or 1'),
|
||||||
rm_count)
|
rm_count)
|
||||||
|
|
||||||
hs_count = _get_inst_count(cluster, 'historyserver')
|
hs_count = _get_inst_count(cluster, 'historyserver')
|
||||||
if hs_count not in [0, 1]:
|
if hs_count > 1:
|
||||||
raise ex.InvalidComponentCountException('historyserver', _('0 or 1'),
|
raise ex.InvalidComponentCountException('historyserver', _('0 or 1'),
|
||||||
hs_count)
|
hs_count)
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ def validate_cluster_creating(pctx, cluster):
|
|||||||
|
|
||||||
oo_count = _get_inst_count(cluster, 'oozie')
|
oo_count = _get_inst_count(cluster, 'oozie')
|
||||||
dn_count = _get_inst_count(cluster, 'datanode')
|
dn_count = _get_inst_count(cluster, 'datanode')
|
||||||
if oo_count not in [0, 1]:
|
if oo_count > 1:
|
||||||
raise ex.InvalidComponentCountException('oozie', _('0 or 1'), oo_count)
|
raise ex.InvalidComponentCountException('oozie', _('0 or 1'), oo_count)
|
||||||
|
|
||||||
if oo_count == 1:
|
if oo_count == 1:
|
||||||
@ -73,7 +73,7 @@ def validate_cluster_creating(pctx, cluster):
|
|||||||
'dfs.replication.'))
|
'dfs.replication.'))
|
||||||
|
|
||||||
hive_count = _get_inst_count(cluster, 'hiveserver')
|
hive_count = _get_inst_count(cluster, 'hiveserver')
|
||||||
if hive_count not in [0, 1]:
|
if hive_count > 1:
|
||||||
raise ex.InvalidComponentCountException('hive', _('0 or 1'),
|
raise ex.InvalidComponentCountException('hive', _('0 or 1'),
|
||||||
hive_count)
|
hive_count)
|
||||||
|
|
||||||
|
@ -67,14 +67,14 @@ class VersionHandler(avm.AbstractVersionHandler):
|
|||||||
jt_count = sum([ng.count for ng
|
jt_count = sum([ng.count for ng
|
||||||
in utils.get_node_groups(cluster, "jobtracker")])
|
in utils.get_node_groups(cluster, "jobtracker")])
|
||||||
|
|
||||||
if jt_count not in [0, 1]:
|
if jt_count > 1:
|
||||||
raise ex.InvalidComponentCountException("jobtracker", _('0 or 1'),
|
raise ex.InvalidComponentCountException("jobtracker", _('0 or 1'),
|
||||||
jt_count)
|
jt_count)
|
||||||
|
|
||||||
oozie_count = sum([ng.count for ng
|
oozie_count = sum([ng.count for ng
|
||||||
in utils.get_node_groups(cluster, "oozie")])
|
in utils.get_node_groups(cluster, "oozie")])
|
||||||
|
|
||||||
if oozie_count not in [0, 1]:
|
if oozie_count > 1:
|
||||||
raise ex.InvalidComponentCountException("oozie", _('0 or 1'),
|
raise ex.InvalidComponentCountException("oozie", _('0 or 1'),
|
||||||
oozie_count)
|
oozie_count)
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ class VersionHandler(avm.AbstractVersionHandler):
|
|||||||
raise ex.RequiredServiceMissingException(
|
raise ex.RequiredServiceMissingException(
|
||||||
"jobtracker", required_by="hive")
|
"jobtracker", required_by="hive")
|
||||||
|
|
||||||
if hive_count not in [0, 1]:
|
if hive_count > 1:
|
||||||
raise ex.InvalidComponentCountException("hive", _('0 or 1'),
|
raise ex.InvalidComponentCountException("hive", _('0 or 1'),
|
||||||
hive_count)
|
hive_count)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user