Allow cluster config for any cluster state
Similar to what the certificates api does, it doesn't make sense to disallow cluster config. story: 2006651 task: 36891 Change-Id: Ia57e95e4570d04c2a20f7674d1ae3e21b8dd8efb Signed-off-by: Spyros Trigazis <spyridon.trigazis@cern.ch>
This commit is contained in:
parent
934cf54854
commit
c0d3683608
@ -382,10 +382,10 @@ class ConfigCluster(command.Command):
|
||||
|
||||
parsed_args.dir = os.path.abspath(parsed_args.dir)
|
||||
cluster = mag_client.clusters.get(parsed_args.cluster)
|
||||
if cluster.status not in ('CREATE_COMPLETE', 'UPDATE_COMPLETE',
|
||||
'ROLLBACK_COMPLETE'):
|
||||
raise exceptions.CommandError("cluster in status %s" %
|
||||
cluster.status)
|
||||
if cluster.api_address is None:
|
||||
self.log.warning("WARNING: The cluster's api_address is"
|
||||
" not known yet.")
|
||||
|
||||
cluster_template = mag_client.cluster_templates.get(
|
||||
cluster.cluster_template_id)
|
||||
opts = {
|
||||
|
@ -468,18 +468,6 @@ export KUBECONFIG={}/config
|
||||
|
||||
self.clusters_mock.get.assert_called_with('fake-cluster')
|
||||
|
||||
def test_cluster_config_with_in_progress_status(self):
|
||||
self._cluster.status = 'CREATE_IN_PROGRESS'
|
||||
|
||||
arglist = ['fake-cluster-1']
|
||||
verifylist = [
|
||||
('cluster', 'fake-cluster-1')
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.assertRaises(exceptions.CommandError,
|
||||
self.cmd.take_action, parsed_args)
|
||||
|
||||
|
||||
class TestClusterResize(TestCluster):
|
||||
|
||||
|
@ -329,15 +329,6 @@ class ShellTest(shell_test_base.TestCommandLineArgument):
|
||||
self._test_arg_success('bay-config --dir /tmp --force xxx')
|
||||
mock_bay.assert_called_with('xxx')
|
||||
|
||||
@mock.patch('magnumclient.v1.baymodels.BayModelManager.get')
|
||||
@mock.patch('magnumclient.v1.bays.BayManager.get')
|
||||
def test_bay_config_failure_wrong_status(self, mock_bay, mock_baymodel):
|
||||
mock_bay.return_value = FakeBay(status='CREATE_IN_PROGRESS')
|
||||
self.assertRaises(exceptions.CommandError,
|
||||
self._test_arg_failure,
|
||||
'bay-config xxx',
|
||||
['.*?^Bay in status: '])
|
||||
|
||||
@mock.patch('magnumclient.v1.bays.BayManager.get')
|
||||
def test_bay_config_failure_no_arg(self, mock_bay):
|
||||
self._test_arg_failure('bay-config', self._few_argument_error)
|
||||
|
@ -447,17 +447,6 @@ class ShellTest(shell_test_base.TestCommandLineArgument):
|
||||
self._test_arg_success('cluster-config --dir /tmp --force xxx')
|
||||
mock_cluster.assert_called_with('xxx')
|
||||
|
||||
@mock.patch('magnumclient.v1.cluster_templates.ClusterTemplateManager.get')
|
||||
@mock.patch('magnumclient.v1.clusters.ClusterManager.get')
|
||||
def test_cluster_config_failure_wrong_status(self,
|
||||
mock_cluster,
|
||||
mock_clustertemplate):
|
||||
mock_cluster.return_value = FakeCluster(status='CREATE_IN_PROGRESS')
|
||||
self.assertRaises(exceptions.CommandError,
|
||||
self._test_arg_failure,
|
||||
'cluster-config xxx',
|
||||
['.*?^Cluster in status: '])
|
||||
|
||||
@mock.patch('magnumclient.v1.clusters.ClusterManager.get')
|
||||
def test_cluster_config_failure_no_arg(self, mock_cluster):
|
||||
self._test_arg_failure('cluster-config', self._few_argument_error)
|
||||
|
@ -228,8 +228,8 @@ def do_bay_config(cs, args):
|
||||
"""
|
||||
args.dir = os.path.abspath(args.dir)
|
||||
bay = cs.bays.get(args.bay)
|
||||
if bay.status not in ('CREATE_COMPLETE', 'UPDATE_COMPLETE'):
|
||||
raise exceptions.CommandError("Bay in status %s" % bay.status)
|
||||
if (hasattr(bay, 'api_address') and bay.api_address is None):
|
||||
print("WARNING: The bay's api_address is not known yet.")
|
||||
baymodel = cs.baymodels.get(bay.baymodel_id)
|
||||
opts = {
|
||||
'cluster_uuid': bay.uuid,
|
||||
|
@ -262,9 +262,8 @@ def do_cluster_config(cs, args):
|
||||
"""
|
||||
args.dir = os.path.abspath(args.dir)
|
||||
cluster = cs.clusters.get(args.cluster)
|
||||
if cluster.status not in ('CREATE_COMPLETE', 'UPDATE_COMPLETE',
|
||||
'ROLLBACK_COMPLETE'):
|
||||
raise exceptions.CommandError("cluster in status %s" % cluster.status)
|
||||
if (hasattr(cluster, 'api_address') and cluster.api_address is None):
|
||||
print("WARNING: The cluster's api_address is not known yet.")
|
||||
cluster_template = cs.cluster_templates.get(cluster.cluster_template_id)
|
||||
opts = {
|
||||
'cluster_uuid': cluster.uuid,
|
||||
|
Loading…
Reference in New Issue
Block a user