Merge "Remove mistral from the set_deployment_status* workflows"

This commit is contained in:
Zuul 2020-02-07 17:44:36 +00:00 committed by Gerrit Code Review
commit d7e6d90060
3 changed files with 35 additions and 33 deletions

View File

@ -1369,7 +1369,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertTrue(fixture.mock_set_deployment_status.called) self.assertTrue(fixture.mock_set_deployment_status.called)
self.assertEqual( self.assertEqual(
'deploying', 'deploying',
fixture.mock_set_deployment_status.call_args[0][1]) fixture.mock_set_deployment_status.call_args[-1]['status']
)
mock_copy.assert_called_once() mock_copy.assert_called_once()
@mock.patch('tripleoclient.utils.copy_clouds_yaml') @mock.patch('tripleoclient.utils.copy_clouds_yaml')
@ -1405,7 +1406,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertTrue(fixture.mock_set_deployment_status.called) self.assertTrue(fixture.mock_set_deployment_status.called)
self.assertEqual( self.assertEqual(
'deploying', 'deploying',
fixture.mock_set_deployment_status.call_args[0][1]) fixture.mock_set_deployment_status.call_args[-1]['status'])
mock_copy.assert_called_once() mock_copy.assert_called_once()
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.' @mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
@ -1449,7 +1450,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertTrue(fixture.mock_set_deployment_status.called) self.assertTrue(fixture.mock_set_deployment_status.called)
self.assertEqual( self.assertEqual(
'failed', 'failed',
fixture.mock_set_deployment_status.call_args[0][1]) fixture.mock_set_deployment_status.call_args[-1]['status'])
@mock.patch('tripleoclient.utils.copy_clouds_yaml') @mock.patch('tripleoclient.utils.copy_clouds_yaml')
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.' @mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'

View File

@ -945,8 +945,10 @@ class DeployOvercloud(command.Command):
if parsed_args.config_download: if parsed_args.config_download:
print("Deploying overcloud configuration") print("Deploying overcloud configuration")
deployment.set_deployment_status( deployment.set_deployment_status(
self.clients, 'deploying', clients=self.clients,
plan=stack.stack_name) plan=stack.stack_name,
status='deploying'
)
try: try:
if not parsed_args.config_download_only: if not parsed_args.config_download_only:
@ -982,8 +984,10 @@ class DeployOvercloud(command.Command):
in_flight_validations=parsed_args.inflight) in_flight_validations=parsed_args.inflight)
except Exception: except Exception:
deployment.set_deployment_status( deployment.set_deployment_status(
self.clients, 'failed', clients=self.clients,
plan=stack.stack_name) plan=stack.stack_name,
status='failed'
)
raise raise
# Force fetching of attributes # Force fetching of attributes

View File

@ -101,7 +101,11 @@ def deploy_and_wait(log, clients, stack, plan_name, verbose_level,
orchestration_client, plan_name, marker, action, verbose_events) orchestration_client, plan_name, marker, action, verbose_events)
if not create_result: if not create_result:
shell.OpenStackShell().run(["stack", "failures", "list", plan_name]) shell.OpenStackShell().run(["stack", "failures", "list", plan_name])
set_deployment_status(clients, 'failed', plan=plan_name) set_deployment_status(
clients=clients,
plan=plan_name,
status='failed'
)
if stack is None: if stack is None:
raise exceptions.DeploymentError("Heat Stack create failed.") raise exceptions.DeploymentError("Heat Stack create failed.")
else: else:
@ -389,35 +393,28 @@ def get_deployment_status(clients, plan):
return deployment_status, plan return deployment_status, plan
def set_deployment_status(clients, status='success', **workflow_input): def set_deployment_status(clients, plan, status):
workflow_client = clients.workflow_engine """Update a given deployment status.
tripleoclients = clients.tripleoclient
if status == 'success': :param clients: application client object.
workflow = 'tripleo.deployment.v1.set_deployment_status_success' :type clients: Object
elif status == 'failed':
workflow = 'tripleo.deployment.v1.set_deployment_status_failed'
elif status == 'deploying':
workflow = 'tripleo.deployment.v1.set_deployment_status_deploying'
else:
raise Exception("Can't set unknown deployment status: %s" % status)
with tripleoclients.messaging_websocket() as ws: :param plan: Plan name.
execution = base.start_workflow( :type plan: String
workflow_client,
workflow,
workflow_input=workflow_input
)
for payload in base.wait_for_messages(workflow_client, ws, execution, :param status: Current status of the deployment.
_WORKFLOW_TIMEOUT): :type status: String
# Just continue until workflow is done """
continue
if payload['status'] != 'SUCCESS': deploy_status = 'DEPLOY_{}'.format(status.upper())
raise exceptions.WorkflowServiceError( utils.update_deployment_status(
'Exception setting deployment status: {}'.format( clients=clients,
payload.get('message', ''))) plan=plan,
status={
'deployment_status': deploy_status,
'status_update': deploy_status
}
)
def get_deployment_failures(clients, **workflow_input): def get_deployment_failures(clients, **workflow_input):