Browse Source

Merge "Remove mistral from the set_deployment_status* workflows"

tags/13.1.0
Zuul 1 week ago
parent
commit
d7e6d90060
3 changed files with 35 additions and 33 deletions
  1. +4
    -3
      tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py
  2. +8
    -4
      tripleoclient/v1/overcloud_deploy.py
  3. +23
    -26
      tripleoclient/workflows/deployment.py

+ 4
- 3
tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py View File

@@ -1369,7 +1369,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertTrue(fixture.mock_set_deployment_status.called)
self.assertEqual(
'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.patch('tripleoclient.utils.copy_clouds_yaml')
@@ -1405,7 +1406,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertTrue(fixture.mock_set_deployment_status.called)
self.assertEqual(
'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.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
@@ -1449,7 +1450,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertTrue(fixture.mock_set_deployment_status.called)
self.assertEqual(
'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.v1.overcloud_deploy.DeployOvercloud.'

+ 8
- 4
tripleoclient/v1/overcloud_deploy.py View File

@@ -945,8 +945,10 @@ class DeployOvercloud(command.Command):
if parsed_args.config_download:
print("Deploying overcloud configuration")
deployment.set_deployment_status(
self.clients, 'deploying',
plan=stack.stack_name)
clients=self.clients,
plan=stack.stack_name,
status='deploying'
)

try:
if not parsed_args.config_download_only:
@@ -982,8 +984,10 @@ class DeployOvercloud(command.Command):
in_flight_validations=parsed_args.inflight)
except Exception:
deployment.set_deployment_status(
self.clients, 'failed',
plan=stack.stack_name)
clients=self.clients,
plan=stack.stack_name,
status='failed'
)
raise

# Force fetching of attributes

+ 23
- 26
tripleoclient/workflows/deployment.py 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)
if not create_result:
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:
raise exceptions.DeploymentError("Heat Stack create failed.")
else:
@@ -389,35 +393,28 @@ def get_deployment_status(clients, plan):
return deployment_status, plan


def set_deployment_status(clients, status='success', **workflow_input):
workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient
def set_deployment_status(clients, plan, status):
"""Update a given deployment status.

if status == 'success':
workflow = 'tripleo.deployment.v1.set_deployment_status_success'
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)
:param clients: application client object.
:type clients: Object

with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow(
workflow_client,
workflow,
workflow_input=workflow_input
)
:param plan: Plan name.
:type plan: String

for payload in base.wait_for_messages(workflow_client, ws, execution,
_WORKFLOW_TIMEOUT):
# Just continue until workflow is done
continue
:param status: Current status of the deployment.
:type status: String
"""

if payload['status'] != 'SUCCESS':
raise exceptions.WorkflowServiceError(
'Exception setting deployment status: {}'.format(
payload.get('message', '')))
deploy_status = 'DEPLOY_{}'.format(status.upper())
utils.update_deployment_status(
clients=clients,
plan=plan,
status={
'deployment_status': deploy_status,
'status_update': deploy_status
}
)


def get_deployment_failures(clients, **workflow_input):

Loading…
Cancel
Save