Merge "Only start the deploy if the Heat stack isn't already in progress"
This commit is contained in:
commit
ac362497b9
|
@ -36,6 +36,10 @@ class DeploymentError(RuntimeError):
|
|||
"""Deployment failed"""
|
||||
|
||||
|
||||
class StackInProgress(RuntimeError):
|
||||
"""Unable to deploy as the stack is busy"""
|
||||
|
||||
|
||||
class RootUserExecution(Exception):
|
||||
"""Command was executed by a root user"""
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ FAKE_STACK = {
|
|||
'CephStorageCount': 0,
|
||||
},
|
||||
'stack_name': 'overcloud',
|
||||
'stack_status': "CREATE_COMPLETE",
|
||||
'outputs': [{
|
||||
'output_key': 'KeystoneURL',
|
||||
'output_value': 'http://0.0.0.0:8000',
|
||||
|
|
|
@ -1399,12 +1399,12 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||
@mock.patch('os.path.relpath', autospec=True)
|
||||
@mock.patch('tripleo_common.update.add_breakpoints_cleanup_into_env',
|
||||
autospec=True)
|
||||
def test__heat_deploy_update_plan_only(self, mock_breakpoints_cleanup,
|
||||
mock_relpath,
|
||||
mock_get_template_contents,
|
||||
mock_upload_missing_files,
|
||||
mock_process_and_upload_env,
|
||||
mock_deploy_and_wait):
|
||||
def test_heat_deploy_update_plan_only(self, mock_breakpoints_cleanup,
|
||||
mock_relpath,
|
||||
mock_get_template_contents,
|
||||
mock_upload_missing_files,
|
||||
mock_process_and_upload_env,
|
||||
mock_deploy_and_wait):
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
|
@ -1427,3 +1427,19 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||
{}, 1, '/tmp', {}, True)
|
||||
|
||||
self.assertFalse(mock_deploy_and_wait.called)
|
||||
|
||||
def test_heat_stack_busy(self):
|
||||
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack(stack_status="IN_PROGRESS")
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
|
||||
arglist = ['--templates', ]
|
||||
verifylist = [
|
||||
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.assertRaises(exceptions.StackInProgress,
|
||||
self.cmd.take_action, parsed_args)
|
||||
|
|
|
@ -1053,6 +1053,11 @@ class DeployOvercloud(command.Command):
|
|||
|
||||
stack = utils.get_stack(orchestration_client, parsed_args.stack)
|
||||
|
||||
if stack and stack.stack_status == 'IN_PROGRESS':
|
||||
raise exceptions.StackInProgress(
|
||||
"Unable to deploy as the stack '{}' status is '{}'".format(
|
||||
stack.stack_name, stack.stack_status))
|
||||
|
||||
parameters = self._update_parameters(
|
||||
parsed_args, clients.network, stack)
|
||||
|
||||
|
|
Loading…
Reference in New Issue