Create *-messages container when setting deployment status

This used to be created earlier by the mistral workflows running before
setting the status. As we've removing those, it has to be created,
if does not exist.

Change-Id: I9600f8b08391b36eae02a051713967b932fa06d3
This commit is contained in:
Rabi Mishra 2020-03-24 08:14:43 +05:30
parent 14fb60ad68
commit 08567fb088
3 changed files with 11 additions and 2 deletions

View File

@ -1674,6 +1674,7 @@ class TestGeneralUtils(base.TestCommand):
self.tc = self.app.client_manager.tripleoclient = mock.Mock()
obj = self.tc.object_store = mock.Mock()
obj.put_object = mock.Mock()
obj.put_container = mock.Mock()
def test_update_deployment_status(self):
mock_status = {
@ -1686,3 +1687,4 @@ class TestGeneralUtils(base.TestCommand):
mock_status
)
self.tc.object_store.put_object.assert_called()
self.tc.object_store.put_container.assert_called()

View File

@ -1721,6 +1721,7 @@ class TestGetDeploymentStatus(utils.TestCommand):
).create_mistral_context
obj = tc.object_store = mock.Mock()
obj.put_object = mock.Mock()
obj.put_container = mock.Mock()
@mock.patch(
'tripleo_common.actions.deployment.DeploymentStatusAction.run',

View File

@ -2483,8 +2483,14 @@ def update_deployment_status(clients, plan, status, message=None):
if not message:
message = 'Status updated without mistral.'
clients.tripleoclient.object_store.put_object(
'{}-messages'.format(plan),
container = '{}-messages'.format(plan)
# create {plan}-messages container if not there
swift = clients.tripleoclient.object_store
swift.put_container(container)
swift.put_object(
container,
'deployment_status.yaml',
yaml.safe_dump(
{