From 94d33fc041881a00598985dd93914aa1c30eddff Mon Sep 17 00:00:00 2001 From: Mathieu Bultel Date: Fri, 20 Apr 2018 11:15:32 +0200 Subject: [PATCH] Use only update/upgrade ansible queue instead Related tripleo-common change: https://review.openstack.org/562995 To avoid race between tripleo queue and ansible queue we need to use inly ansible queue for update and upgrade Change-Id: I39b5a1a154b10683ac0de85afd6bbadc3491192a Partial-Bug: #1783798 (cherry picked from commit 3b197c09911997e0f7ff127deff892e064a58786) (cherry picked from commit 782ad7375cf17efe99332e4ac2d0a1a9a5cd1b39) --- .../overcloud_update/test_overcloud_update.py | 1 - tripleoclient/v1/overcloud_update.py | 1 - tripleoclient/workflows/package_update.py | 18 ++++-------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py b/tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py index 7ec2e1a85..b9ee02efa 100644 --- a/tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py +++ b/tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py @@ -118,6 +118,5 @@ class TestOvercloudUpdate(fakes.TestOvercloudUpdate): nodes='Compute', inventory_file=mock_open().read(), playbook='fake-playbook.yaml', - queue_name=str(uuid.uuid4()), ansible_queue_name=constants.UPDATE_QUEUE ) diff --git a/tripleoclient/v1/overcloud_update.py b/tripleoclient/v1/overcloud_update.py index 65912d255..dce872b13 100644 --- a/tripleoclient/v1/overcloud_update.py +++ b/tripleoclient/v1/overcloud_update.py @@ -146,5 +146,4 @@ class UpdateOvercloud(command.Command): clients, nodes=nodes, inventory_file=inventory, playbook=playbook, - queue_name=str(uuid.uuid4()), ansible_queue_name=constants.UPDATE_QUEUE) diff --git a/tripleoclient/workflows/package_update.py b/tripleoclient/workflows/package_update.py index 724a020e7..e4d730f76 100644 --- a/tripleoclient/workflows/package_update.py +++ b/tripleoclient/workflows/package_update.py @@ -77,31 +77,21 @@ def get_config(clients, **workflow_input): def update_ansible(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] ansible_queue = workflow_input['ansible_queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket(ansible_queue) as update_ws: execution = base.start_workflow( workflow_client, 'tripleo.package_update.v1.update_nodes', workflow_input=workflow_input ) - with tripleoclients.messaging_websocket(ansible_queue) as update_ws: - for payload in base.wait_for_messages(workflow_client, - update_ws, - execution): - # Need to sleep a little, to let the time for the execution - # to get the right status in between. It avoid to fall in the - # while True loop to get messages - time.sleep(5) + for payload in base.wait_for_messages(workflow_client, + update_ws, + execution): if payload.get('message'): pprint.pprint(payload['message'].splitlines()) - for payload in base.wait_for_messages(workflow_client, ws, execution): - if payload.get('message'): - print(payload) - if payload['status'] == 'SUCCESS': print('Success') else: