From 1bd1620eadf23f2ee755a32a8167d9a5386a392e Mon Sep 17 00:00:00 2001 From: Toure Dunnon Date: Thu, 5 Oct 2017 16:48:39 -0400 Subject: [PATCH] Tripleoclient unified queue name. This will allow the cli and tripleo UI to share a common queue, which will help with scripting the frontend behaviour or track the progress of the cli from the frontend. Related-Bug: #1603345 Change-Id: I5849983eee82b5a56cae1bf38a3c2694b6b291db --- tripleoclient/plugin.py | 6 +- tripleoclient/tests/fakes.py | 2 +- tripleoclient/tests/v1/baremetal/fakes.py | 2 +- .../tests/v1/baremetal/test_baremetal.py | 19 +---- .../tests/v1/overcloud_deploy/fakes.py | 2 +- .../tests/v1/overcloud_node/fakes.py | 6 +- .../v1/overcloud_node/test_overcloud_node.py | 51 ++++-------- .../tests/v1/overcloud_update/fakes.py | 2 +- .../overcloud_update/test_overcloud_update.py | 7 +- tripleoclient/tests/v1/test_overcloud_plan.py | 26 +------ tripleoclient/tests/v1/test_overcloud_raid.py | 2 - .../tests/workflows/test_baremetal.py | 78 ++++++++----------- .../tests/workflows/test_parameters.py | 23 ++---- .../tests/workflows/test_plan_management.py | 19 ++--- tripleoclient/tests/workflows/test_support.py | 26 ++----- tripleoclient/v1/baremetal.py | 14 +--- tripleoclient/v1/overcloud_deploy.py | 6 +- tripleoclient/v1/overcloud_execute.py | 7 +- tripleoclient/v1/overcloud_node.py | 48 ++++-------- tripleoclient/v1/overcloud_plan.py | 10 ++- tripleoclient/v1/overcloud_raid.py | 3 - tripleoclient/v1/overcloud_update.py | 10 +-- tripleoclient/workflows/baremetal.py | 40 ++++------ tripleoclient/workflows/deployment.py | 7 +- tripleoclient/workflows/package_update.py | 7 +- tripleoclient/workflows/parameters.py | 18 ++--- tripleoclient/workflows/plan_management.py | 9 +-- tripleoclient/workflows/scale.py | 6 +- tripleoclient/workflows/stack_management.py | 9 +-- tripleoclient/workflows/support.py | 9 +-- tripleoclient/workflows/validations.py | 3 +- 31 files changed, 141 insertions(+), 336 deletions(-) diff --git a/tripleoclient/plugin.py b/tripleoclient/plugin.py index 5fc88530a..72877d1a2 100644 --- a/tripleoclient/plugin.py +++ b/tripleoclient/plugin.py @@ -67,7 +67,7 @@ def build_option_parser(parser): class WebsocketClient(object): - def __init__(self, instance, queue_name): + def __init__(self, instance, queue_name="tripleo"): self._project_id = None self._ws = None self._websocket_client_id = None @@ -195,9 +195,9 @@ class ClientWrapper(object): self._local_orchestration = client return self._local_orchestration - def messaging_websocket(self, queue_name='tripleo'): + def messaging_websocket(self): """Returns a websocket for the messaging service""" - return WebsocketClient(self._instance, queue_name) + return WebsocketClient(self._instance) @property def object_store(self): diff --git a/tripleoclient/tests/fakes.py b/tripleoclient/tests/fakes.py index 7333cbf89..3c550d557 100644 --- a/tripleoclient/tests/fakes.py +++ b/tripleoclient/tests/fakes.py @@ -62,5 +62,5 @@ class FakeClientWrapper(object): def __init__(self): self.ws = FakeWebSocket() - def messaging_websocket(self, queue_name="tripleo"): + def messaging_websocket(self): return self.ws diff --git a/tripleoclient/tests/v1/baremetal/fakes.py b/tripleoclient/tests/v1/baremetal/fakes.py index 57fdde10f..bb7347bb0 100644 --- a/tripleoclient/tests/v1/baremetal/fakes.py +++ b/tripleoclient/tests/v1/baremetal/fakes.py @@ -103,7 +103,7 @@ class ClientWrapper(object): return_value=self._mock_websocket) self._mock_websocket.__exit__ = mock.Mock() - def messaging_websocket(self, queue_name='tripleo'): + def messaging_websocket(self): return self._mock_websocket diff --git a/tripleoclient/tests/v1/baremetal/test_baremetal.py b/tripleoclient/tests/v1/baremetal/test_baremetal.py index 1ec5f8296..4d0005bbf 100644 --- a/tripleoclient/tests/v1/baremetal/test_baremetal.py +++ b/tripleoclient/tests/v1/baremetal/test_baremetal.py @@ -355,10 +355,6 @@ pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58,6230""") websocket.wait_for_messages.return_value = self.mock_websocket_success self.websocket = websocket - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - def tearDown(self): super(TestImportBaremetal, self).tearDown() @@ -376,7 +372,6 @@ pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58,6230""") 'tripleo.baremetal.v1.register_or_update', workflow_input={ 'kernel_name': kernel_name, 'nodes_json': self.nodes_list, - 'queue_name': 'UUID4', 'ramdisk_name': ramdisk_name, 'instance_boot_option': 'local' if local else 'netboot', 'initial_state': 'available', @@ -596,10 +591,6 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal): websocket = tripleoclients.messaging_websocket() self.websocket = websocket - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - # Get the command object to test self.cmd = baremetal.StartBaremetalIntrospectionBulk(self.app, None) @@ -609,14 +600,13 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal): 'tripleo.baremetal.v1.introspect_manageable_nodes', workflow_input={ 'run_validations': False, - 'queue_name': 'UUID4' } )] if provide: call_list.append(mock.call( 'tripleo.baremetal.v1.provide_manageable_nodes', - workflow_input={'queue_name': 'UUID4'} + workflow_input={} )) self.workflow.executions.create.assert_has_calls(call_list) @@ -900,12 +890,7 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal): "message": "" }] * 2) - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - - self.workflow_input = {'queue_name': 'UUID4', - 'node_uuids': ['ABCDEFGH'], + self.workflow_input = {'node_uuids': ['ABCDEFGH'], 'kernel_name': 'bm-deploy-kernel', 'ramdisk_name': 'bm-deploy-ramdisk', 'root_device': None, diff --git a/tripleoclient/tests/v1/overcloud_deploy/fakes.py b/tripleoclient/tests/v1/overcloud_deploy/fakes.py index a9c60ad63..50db7ec9d 100644 --- a/tripleoclient/tests/v1/overcloud_deploy/fakes.py +++ b/tripleoclient/tests/v1/overcloud_deploy/fakes.py @@ -110,7 +110,7 @@ class FakeClientWrapper(object): self._instance = mock.Mock() self.object_store = FakeObjectClient() - def messaging_websocket(self, queue_name="tripleo"): + def messaging_websocket(self): return fakes.FakeWebSocket() diff --git a/tripleoclient/tests/v1/overcloud_node/fakes.py b/tripleoclient/tests/v1/overcloud_node/fakes.py index a84be4390..019bc9e94 100644 --- a/tripleoclient/tests/v1/overcloud_node/fakes.py +++ b/tripleoclient/tests/v1/overcloud_node/fakes.py @@ -26,7 +26,7 @@ class FakeClientWrapper(object): return_value=self._mock_websocket) self._mock_websocket.__exit__ = mock.Mock() - def messaging_websocket(self, queue_name='tripleo'): + def messaging_websocket(self): return self._mock_websocket @@ -48,7 +48,3 @@ class TestOvercloudNode(utils.TestCommand): self.app.client_manager.baremetal = mock.Mock() self.app.client_manager.workflow_engine = mock.Mock() self.app.client_manager.tripleoclient = FakeClientWrapper() - - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) diff --git a/tripleoclient/tests/v1/overcloud_node/test_overcloud_node.py b/tripleoclient/tests/v1/overcloud_node/test_overcloud_node.py index a29436062..09cd6ada0 100644 --- a/tripleoclient/tests/v1/overcloud_node/test_overcloud_node.py +++ b/tripleoclient/tests/v1/overcloud_node/test_overcloud_node.py @@ -47,11 +47,6 @@ class TestDeleteNode(fakes.TestDeleteNode): self.stack_name = self.app.client_manager.orchestration.stacks.get self.stack_name.return_value = mock.Mock(stack_name="overcloud") - # Mock UUID4 generation for every test - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - # TODO(someone): This test does not pass with autospec=True, it should # probably be fixed so that it can pass with that. def test_node_delete(self): @@ -77,7 +72,6 @@ class TestDeleteNode(fakes.TestDeleteNode): 'tripleo.scale.v1.delete_node', workflow_input={ 'container': 'overcast', - 'queue_name': 'UUID4', 'nodes': ['instance1', 'instance2'] }) @@ -121,7 +115,6 @@ class TestDeleteNode(fakes.TestDeleteNode): 'tripleo.scale.v1.delete_node', workflow_input={ 'container': 'overcloud', - 'queue_name': 'UUID4', 'nodes': ['instance1', ] }) @@ -149,7 +142,6 @@ class TestDeleteNode(fakes.TestDeleteNode): 'tripleo.scale.v1.delete_node', workflow_input={ 'container': 'overcloud', - 'queue_name': 'UUID4', 'nodes': ['wrong_instance', ] }) @@ -180,7 +172,7 @@ class TestProvideNode(fakes.TestOvercloudNode): self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.provide_manageable_nodes', - workflow_input={'queue_name': 'UUID4'} + workflow_input={} ) def test_provide_one_node(self): @@ -192,9 +184,8 @@ class TestProvideNode(fakes.TestOvercloudNode): self.cmd.take_action(parsed_args) self.workflow.executions.create.assert_called_once_with( - 'tripleo.baremetal.v1.provide', workflow_input={ - 'node_uuids': [node_id], - 'queue_name': 'UUID4'} + 'tripleo.baremetal.v1.provide', + workflow_input={'node_uuids': [node_id]} ) def test_provide_multiple_nodes(self): @@ -209,8 +200,7 @@ class TestProvideNode(fakes.TestOvercloudNode): self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.provide', workflow_input={ - 'node_uuids': [node_id1, node_id2], - 'queue_name': 'UUID4' + 'node_uuids': [node_id1, node_id2] } ) @@ -251,16 +241,13 @@ class TestIntrospectNode(fakes.TestOvercloudNode): call_list = [mock.call( 'tripleo.baremetal.v1.introspect_manageable_nodes', - workflow_input={ - 'run_validations': False, - 'queue_name': 'UUID4' - } + workflow_input={'run_validations': False} )] if provide: call_list.append(mock.call( 'tripleo.baremetal.v1.provide_manageable_nodes', - workflow_input={'queue_name': 'UUID4'} + workflow_input={} )) self.workflow.executions.create.assert_has_calls(call_list) @@ -278,15 +265,13 @@ class TestIntrospectNode(fakes.TestOvercloudNode): call_list = [mock.call( 'tripleo.baremetal.v1.introspect', workflow_input={ 'node_uuids': nodes, - 'run_validations': False, - 'queue_name': 'UUID4'} + 'run_validations': False} )] if provide: call_list.append(mock.call( 'tripleo.baremetal.v1.provide', workflow_input={ - 'node_uuids': nodes, - 'queue_name': 'UUID4'} + 'node_uuids': nodes} )) self.workflow.executions.create.assert_has_calls(call_list) @@ -391,7 +376,6 @@ class TestImportNode(fakes.TestOvercloudNode): call_list = [mock.call( 'tripleo.baremetal.v1.register_or_update', workflow_input={ 'nodes_json': nodes_list, - 'queue_name': 'UUID4', 'kernel_name': None if no_deploy_image else 'bm-deploy-kernel', 'ramdisk_name': (None if no_deploy_image else 'bm-deploy-ramdisk'), @@ -404,16 +388,14 @@ class TestImportNode(fakes.TestOvercloudNode): call_list.append(mock.call( 'tripleo.baremetal.v1.introspect', workflow_input={ 'node_uuids': ['MOCK_NODE_UUID'], - 'run_validations': False, - 'queue_name': 'UUID4'} + 'run_validations': False} )) if provide: call_count += 1 call_list.append(mock.call( 'tripleo.baremetal.v1.provide', workflow_input={ - 'node_uuids': ['MOCK_NODE_UUID'], - 'queue_name': 'UUID4' + 'node_uuids': ['MOCK_NODE_UUID'] } )) @@ -484,8 +466,7 @@ class TestConfigureNode(fakes.TestOvercloudNode): # Get the command object to test self.cmd = overcloud_node.ConfigureNode(self.app, None) - self.workflow_input = {'queue_name': 'UUID4', - 'kernel_name': 'bm-deploy-kernel', + self.workflow_input = {'kernel_name': 'bm-deploy-kernel', 'ramdisk_name': 'bm-deploy-ramdisk', 'instance_boot_option': None, 'root_device': None, @@ -673,7 +654,6 @@ class TestDiscoverNode(fakes.TestOvercloudNode): 'tripleo.baremetal.v1.discover_and_enroll_nodes', workflow_input={'ip_addresses': '10.0.0.0/24', 'credentials': [['admin', 'password']], - 'queue_name': mock.ANY, 'kernel_name': 'bm-deploy-kernel', 'ramdisk_name': 'bm-deploy-ramdisk', 'instance_boot_option': 'local'} @@ -692,7 +672,6 @@ class TestDiscoverNode(fakes.TestOvercloudNode): 'tripleo.baremetal.v1.discover_and_enroll_nodes', workflow_input={'ip_addresses': ['10.0.0.1', '10.0.0.2'], 'credentials': [['admin', 'password']], - 'queue_name': mock.ANY, 'kernel_name': 'bm-deploy-kernel', 'ramdisk_name': 'bm-deploy-ramdisk', 'instance_boot_option': 'local'} @@ -723,16 +702,14 @@ class TestDiscoverNode(fakes.TestOvercloudNode): 'credentials': [['admin', 'password'], ['admin2', 'password2']], 'ports': [623, 6230], - 'queue_name': mock.ANY, 'kernel_name': None, 'ramdisk_name': None, 'instance_boot_option': 'netboot'}), mock.call('tripleo.baremetal.v1.introspect', workflow_input={'node_uuids': ['MOCK_NODE_UUID'], - 'run_validations': True, - 'queue_name': mock.ANY}), + 'run_validations': True}), mock.call('tripleo.baremetal.v1.provide', - workflow_input={'node_uuids': ['MOCK_NODE_UUID'], - 'queue_name': mock.ANY}), + workflow_input={'node_uuids': ['MOCK_NODE_UUID']} + ) ] self.workflow.executions.create.assert_has_calls(workflows_calls) diff --git a/tripleoclient/tests/v1/overcloud_update/fakes.py b/tripleoclient/tests/v1/overcloud_update/fakes.py index 1f19a9fae..5a5555a65 100644 --- a/tripleoclient/tests/v1/overcloud_update/fakes.py +++ b/tripleoclient/tests/v1/overcloud_update/fakes.py @@ -25,7 +25,7 @@ class FakeClientWrapper(object): self._instance = mock.Mock() self.object_store = FakeObjectClient() - def messaging_websocket(self, queue_name="tripleo"): + def messaging_websocket(self): return fakes.FakeWebSocket() diff --git a/tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py b/tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py index 1703ca23c..5205cce88 100644 --- a/tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py +++ b/tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py @@ -14,7 +14,6 @@ # import mock -import uuid from tripleoclient import exceptions from tripleoclient.tests.v1.overcloud_update import fakes @@ -64,8 +63,8 @@ class TestOvercloudUpdate(fakes.TestOvercloudUpdate): mock_update.assert_called_once_with( self.app.client_manager, container='mystack', - container_registry={'fake_container': 'fake_value'}, - queue_name=str(uuid.uuid4())) + container_registry={'fake_container': 'fake_value'} + ) @mock.patch('tripleoclient.workflows.package_update.update', autospec=True) @@ -116,4 +115,4 @@ class TestOvercloudUpdate(fakes.TestOvercloudUpdate): nodes='Compute', inventory_file=mock_open().read(), playbook='fake-playbook.yaml', - queue_name=str(uuid.uuid4())) + ) diff --git a/tripleoclient/tests/v1/test_overcloud_plan.py b/tripleoclient/tests/v1/test_overcloud_plan.py index 30f83c417..51749abd6 100644 --- a/tripleoclient/tests/v1/test_overcloud_plan.py +++ b/tripleoclient/tests/v1/test_overcloud_plan.py @@ -108,11 +108,6 @@ class TestOvercloudCreatePlan(utils.TestCommand): self.workflow = self.app.client_manager.workflow_engine self.swift = self.app.client_manager.tripleoclient.object_store - # Mock UUID4 generation for every test - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - def test_create_default_plan(self): # Setup @@ -136,7 +131,6 @@ class TestOvercloudCreatePlan(utils.TestCommand): 'tripleo.plan_management.v1.create_deployment_plan', workflow_input={ 'container': 'overcast', - 'queue_name': 'UUID4', 'generate_passwords': True, 'use_default_templates': True, 'source_url': None @@ -166,7 +160,6 @@ class TestOvercloudCreatePlan(utils.TestCommand): 'tripleo.plan_management.v1.create_deployment_plan', workflow_input={ 'container': 'overcast', - 'queue_name': 'UUID4', 'generate_passwords': True, 'use_default_templates': True, 'source_url': None @@ -203,7 +196,6 @@ class TestOvercloudCreatePlan(utils.TestCommand): 'tripleo.plan_management.v1.create_deployment_plan', workflow_input={ 'container': 'overcast', - 'queue_name': 'UUID4', 'generate_passwords': True }) @@ -261,7 +253,6 @@ class TestOvercloudCreatePlan(utils.TestCommand): 'tripleo.plan_management.v1.create_deployment_plan', workflow_input={ 'container': 'overcast', - 'queue_name': 'UUID4', 'generate_passwords': True }) @@ -307,7 +298,6 @@ class TestOvercloudCreatePlan(utils.TestCommand): 'tripleo.plan_management.v1.create_deployment_plan', workflow_input={ 'container': 'overcast', - 'queue_name': 'UUID4', 'generate_passwords': True }) @@ -341,7 +331,6 @@ class TestOvercloudCreatePlan(utils.TestCommand): 'tripleo.plan_management.v1.create_deployment_plan', workflow_input={ 'container': 'overcast', - 'queue_name': 'UUID4', 'use_default_templates': True, 'generate_passwords': False, 'source_url': None @@ -367,11 +356,6 @@ class TestOvercloudDeployPlan(utils.TestCommand): self.tripleoclient.messaging_websocket.return_value = self.websocket self.app.client_manager.tripleoclient = self.tripleoclient - # Mock UUID4 generation for every test - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - sleep_patch = mock.patch('time.sleep') self.addCleanup(sleep_patch.stop) sleep_patch.start() @@ -406,7 +390,6 @@ class TestOvercloudDeployPlan(utils.TestCommand): workflow_input={ 'container': 'overcast', 'run_validations': True, - 'queue_name': 'UUID4', 'skip_deploy_identifier': False } ) @@ -420,11 +403,6 @@ class TestOvercloudExportPlan(utils.TestCommand): self.app.client_manager = mock.Mock() self.clients = self.app.client_manager - # Mock UUID4 generation for every test - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - # Mock urlopen f = mock.Mock() f.read.return_value = 'tarball contents' @@ -446,7 +424,7 @@ class TestOvercloudExportPlan(utils.TestCommand): self.cmd.take_action(parsed_args) export_deployment_plan_mock.assert_called_once_with( - self.clients, plan='test-plan', queue_name='UUID4') + self.clients, plan='test-plan') @mock.patch('os.path.exists') def test_export_plan_outfile_exists(self, exists_mock): @@ -478,4 +456,4 @@ class TestOvercloudExportPlan(utils.TestCommand): self.cmd.take_action(parsed_args) export_deployment_plan_mock.assert_called_once_with( - self.clients, plan='test-plan', queue_name='UUID4') + self.clients, plan='test-plan') diff --git a/tripleoclient/tests/v1/test_overcloud_raid.py b/tripleoclient/tests/v1/test_overcloud_raid.py index a81eaa134..47df66a91 100644 --- a/tripleoclient/tests/v1/test_overcloud_raid.py +++ b/tripleoclient/tests/v1/test_overcloud_raid.py @@ -63,7 +63,6 @@ class TestCreateRAID(fakes.TestBaremetal): workflow_input={ 'node_uuids': ['uuid1', 'uuid2'], 'configuration': self.conf, - 'queue_name': mock.ANY, } ) @@ -85,7 +84,6 @@ class TestCreateRAID(fakes.TestBaremetal): workflow_input={ 'node_uuids': ['uuid1', 'uuid2'], 'configuration': self.conf, - 'queue_name': mock.ANY, } ) diff --git a/tripleoclient/tests/workflows/test_baremetal.py b/tripleoclient/tests/workflows/test_baremetal.py index f8e7bb718..13a8a08bf 100644 --- a/tripleoclient/tests/workflows/test_baremetal.py +++ b/tripleoclient/tests/workflows/test_baremetal.py @@ -52,7 +52,6 @@ class TestBaremetalWorkflows(utils.TestCommand): self.assertEqual(baremetal.register_or_update( self.app.client_manager, nodes_json=[], - queue_name="QUEUE_NAME", kernel_name="kernel", ramdisk_name="ramdisk" ), []) @@ -61,7 +60,6 @@ class TestBaremetalWorkflows(utils.TestCommand): 'tripleo.baremetal.v1.register_or_update', workflow_input={ 'kernel_name': 'kernel', - 'queue_name': 'QUEUE_NAME', 'nodes_json': [], 'ramdisk_name': 'ramdisk' }) @@ -75,7 +73,6 @@ class TestBaremetalWorkflows(utils.TestCommand): baremetal.register_or_update, self.app.client_manager, nodes_json=[], - queue_name="QUEUE_NAME", kernel_name="kernel", ramdisk_name="ramdisk" ) @@ -84,7 +81,6 @@ class TestBaremetalWorkflows(utils.TestCommand): 'tripleo.baremetal.v1.register_or_update', workflow_input={ 'kernel_name': 'kernel', - 'queue_name': 'QUEUE_NAME', 'nodes_json': [], 'ramdisk_name': 'ramdisk' }) @@ -93,14 +89,12 @@ class TestBaremetalWorkflows(utils.TestCommand): self.websocket.wait_for_messages.return_value = self.message_success - baremetal.provide(self.app.client_manager, node_uuids=[], - queue_name="QUEUE_NAME") + baremetal.provide(self.app.client_manager, node_uuids=[]) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.provide', workflow_input={ 'node_uuids': [], - 'queue_name': "QUEUE_NAME" }) def test_provide_error(self): @@ -111,14 +105,13 @@ class TestBaremetalWorkflows(utils.TestCommand): exceptions.NodeProvideError, baremetal.provide, self.app.client_manager, - node_uuids=[], - queue_name="QUEUE_NAME") + node_uuids=[] + ) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.provide', workflow_input={ 'node_uuids': [], - 'queue_name': "QUEUE_NAME" }) def test_format_provide_errors(self): @@ -140,22 +133,21 @@ class TestBaremetalWorkflows(utils.TestCommand): exceptions.NodeProvideError, baremetal.provide, self.app.client_manager, - node_uuids=[], - queue_name="QUEUE_NAME") + node_uuids=[] + ) def test_introspect_success(self): self.websocket.wait_for_messages.return_value = self.message_success baremetal.introspect(self.app.client_manager, node_uuids=[], - run_validations=True, queue_name="QUEUE_NAME") + run_validations=True) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.introspect', workflow_input={ 'node_uuids': [], 'run_validations': True, - 'queue_name': "QUEUE_NAME" }) def test_introspect_error(self): @@ -167,15 +159,14 @@ class TestBaremetalWorkflows(utils.TestCommand): baremetal.introspect, self.app.client_manager, node_uuids=[], - run_validations=False, - queue_name="QUEUE_NAME") + run_validations=False + ) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.introspect', workflow_input={ 'node_uuids': [], 'run_validations': False, - 'queue_name': "QUEUE_NAME" }) def test_introspect_manageable_nodes_success(self): @@ -187,14 +178,12 @@ class TestBaremetalWorkflows(utils.TestCommand): }]) baremetal.introspect_manageable_nodes( - self.app.client_manager, run_validations=False, - queue_name="QUEUE_NAME") - + self.app.client_manager, run_validations=False + ) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.introspect_manageable_nodes', workflow_input={ 'run_validations': False, - 'queue_name': "QUEUE_NAME" }) def test_introspect_manageable_nodes_error(self): @@ -205,14 +194,13 @@ class TestBaremetalWorkflows(utils.TestCommand): exceptions.IntrospectionError, baremetal.introspect_manageable_nodes, self.app.client_manager, - run_validations=False, - queue_name="QUEUE_NAME") + run_validations=False + ) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.introspect_manageable_nodes', workflow_input={ 'run_validations': False, - 'queue_name': "QUEUE_NAME" }) def test_introspect_manageable_nodes_mixed_status(self): @@ -228,14 +216,13 @@ class TestBaremetalWorkflows(utils.TestCommand): exceptions.IntrospectionError, baremetal.introspect_manageable_nodes, self.app.client_manager, - run_validations=False, - queue_name="QUEUE_NAME") + run_validations=False + ) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.introspect_manageable_nodes', workflow_input={ 'run_validations': False, - 'queue_name': "QUEUE_NAME" }) def test_provide_manageable_nodes_success(self): @@ -243,11 +230,13 @@ class TestBaremetalWorkflows(utils.TestCommand): self.websocket.wait_for_messages.return_value = self.message_success baremetal.provide_manageable_nodes( - self.app.client_manager, queue_name="QUEUE_NAME") + self.app.client_manager + ) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.provide_manageable_nodes', - workflow_input={'queue_name': "QUEUE_NAME"}) + workflow_input={} + ) def test_provide_manageable_nodes_error(self): @@ -256,24 +245,23 @@ class TestBaremetalWorkflows(utils.TestCommand): self.assertRaises( exceptions.NodeProvideError, baremetal.provide_manageable_nodes, - self.app.client_manager, queue_name="QUEUE_NAME") + self.app.client_manager) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.provide_manageable_nodes', - workflow_input={'queue_name': "QUEUE_NAME"}) + workflow_input={} + ) def test_configure_success(self): self.websocket.wait_for_messages.return_value = self.message_success - baremetal.configure(self.app.client_manager, node_uuids=[], - queue_name="QUEUE_NAME") + baremetal.configure(self.app.client_manager, node_uuids=[]) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.configure', workflow_input={ 'node_uuids': [], - 'queue_name': "QUEUE_NAME" }) def test_configure_error(self): @@ -284,28 +272,25 @@ class TestBaremetalWorkflows(utils.TestCommand): exceptions.NodeConfigurationError, baremetal.configure, self.app.client_manager, - node_uuids=[], - queue_name="QUEUE_NAME") + node_uuids=[] + ) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.configure', workflow_input={ 'node_uuids': [], - 'queue_name': "QUEUE_NAME" }) def test_configure_manageable_nodes_success(self): self.websocket.wait_for_messages.return_value = self.message_success - baremetal.configure_manageable_nodes(self.app.client_manager, - queue_name="QUEUE_NAME") + baremetal.configure_manageable_nodes(self.app.client_manager) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.configure_manageable_nodes', - workflow_input={ - 'queue_name': "QUEUE_NAME" - }) + workflow_input={} + ) def test_configure_manageable_nodes_error(self): @@ -314,11 +299,10 @@ class TestBaremetalWorkflows(utils.TestCommand): self.assertRaises( exceptions.NodeConfigurationError, baremetal.configure_manageable_nodes, - self.app.client_manager, - queue_name="QUEUE_NAME") + self.app.client_manager + ) self.workflow.executions.create.assert_called_once_with( 'tripleo.baremetal.v1.configure_manageable_nodes', - workflow_input={ - 'queue_name': "QUEUE_NAME" - }) + workflow_input={} + ) diff --git a/tripleoclient/tests/workflows/test_parameters.py b/tripleoclient/tests/workflows/test_parameters.py index 224b7f3dc..3cb338adf 100644 --- a/tripleoclient/tests/workflows/test_parameters.py +++ b/tripleoclient/tests/workflows/test_parameters.py @@ -13,7 +13,6 @@ # under the License. import mock -import uuid from osc_lib.tests import utils @@ -44,10 +43,6 @@ class TestParameterWorkflows(utils.TestCommand): self.tripleoclient.messaging_websocket.return_value = self.websocket self.app.client_manager.tripleoclient = self.tripleoclient - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - def test_get_overcloud_passwords(self): self.websocket.wait_for_messages.return_value = iter([{ "execution": {"id": "IDID"}, @@ -57,13 +52,12 @@ class TestParameterWorkflows(utils.TestCommand): parameters.get_overcloud_passwords( self.app.client_manager, - container='container-name', - queue_name=str(uuid.uuid4())) + container='container-name' + ) self.workflow.executions.create.assert_called_once_with( 'tripleo.plan_management.v1.get_passwords', - workflow_input={'queue_name': 'UUID4', - 'container': 'container-name'}) + workflow_input={'container': 'container-name'}) @mock.patch('yaml.safe_load') @mock.patch("six.moves.builtins.open") @@ -95,7 +89,6 @@ class TestParameterWorkflows(utils.TestCommand): 'tripleo.derive_params.v1.derive_parameters', workflow_input={ 'plan': 'overcloud', - 'queue_name': 'UUID4', 'user_inputs': { 'num_phy_cores_per_numa_node_for_pmd': 2}}) @@ -129,7 +122,6 @@ class TestParameterWorkflows(utils.TestCommand): 'tripleo.derive_params.v1.derive_parameters', workflow_input={ 'plan': 'overcloud', - 'queue_name': 'UUID4', 'user_inputs': { 'num_phy_cores_per_numa_node_for_pmd': 2}}) @@ -173,8 +165,7 @@ class TestParameterWorkflows(utils.TestCommand): self.workflow.executions.create.assert_called_once_with( 'tripleo.plan_management.v1.get_deprecated_parameters', - workflow_input={'queue_name': 'UUID4', - 'container': 'container-name'}) + workflow_input={'container': 'container-name'}) @mock.patch("sys.stdout", new_callable=TestStringCapture) def test_check_deprecated_params_user_defined(self, mock_print): @@ -193,8 +184,7 @@ class TestParameterWorkflows(utils.TestCommand): self.workflow.executions.create.assert_called_once_with( 'tripleo.plan_management.v1.get_deprecated_parameters', - workflow_input={'queue_name': 'UUID4', - 'container': 'container-name'}) + workflow_input={'container': 'container-name'}) std_output = mock_print.getvalue() self.assertIn('TestParameter1', std_output) @@ -215,8 +205,7 @@ class TestParameterWorkflows(utils.TestCommand): self.workflow.executions.create.assert_called_once_with( 'tripleo.plan_management.v1.get_deprecated_parameters', - workflow_input={'queue_name': 'UUID4', - 'container': 'container-name'}) + workflow_input={'container': 'container-name'}) std_output = mock_print.getvalue() self.assertNotIn('TestParameter1', std_output) diff --git a/tripleoclient/tests/workflows/test_plan_management.py b/tripleoclient/tests/workflows/test_plan_management.py index 64dc5e89d..1d5adeb95 100644 --- a/tripleoclient/tests/workflows/test_plan_management.py +++ b/tripleoclient/tests/workflows/test_plan_management.py @@ -39,10 +39,6 @@ class TestPlanCreationWorkflows(utils.TestCommand): "status": "SUCCESS", }]) - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - @mock.patch('tripleoclient.workflows.plan_management.tarball', autospec=True) def test_create_plan_from_templates_success(self, mock_tarball): @@ -62,8 +58,7 @@ class TestPlanCreationWorkflows(utils.TestCommand): self.workflow.executions.create.assert_called_once_with( 'tripleo.plan_management.v1.create_deployment_plan', - workflow_input={'queue_name': 'UUID4', - 'container': 'test-overcloud', + workflow_input={'container': 'test-overcloud', 'generate_passwords': True}) @mock.patch('tripleoclient.workflows.plan_management.tarball', @@ -108,8 +103,7 @@ class TestPlanCreationWorkflows(utils.TestCommand): self.workflow.executions.create.assert_called_once_with( 'tripleo.plan_management.v1.create_deployment_plan', - workflow_input={'queue_name': 'UUID4', - 'container': 'test-overcloud', + workflow_input={'container': 'test-overcloud', 'generate_passwords': True}) mock_open_context.assert_has_calls( @@ -140,8 +134,7 @@ class TestPlanCreationWorkflows(utils.TestCommand): self.workflow.executions.create.assert_called_once_with( 'tripleo.plan_management.v1.create_deployment_plan', - workflow_input={'queue_name': 'UUID4', - 'container': 'test-overcloud', + workflow_input={'container': 'test-overcloud', 'generate_passwords': True}) mock_open_context.assert_has_calls( @@ -172,8 +165,7 @@ class TestPlanCreationWorkflows(utils.TestCommand): self.workflow.executions.create.assert_called_once_with( 'tripleo.plan_management.v1.create_deployment_plan', - workflow_input={'queue_name': 'UUID4', - 'container': 'test-overcloud', + workflow_input={'container': 'test-overcloud', 'generate_passwords': True}) mock_open_context.assert_has_calls( @@ -215,8 +207,7 @@ class TestPlanCreationWorkflows(utils.TestCommand): self.workflow.executions.create.assert_called_once_with( 'tripleo.plan_management.v1.create_deployment_plan', - workflow_input={'queue_name': 'UUID4', - 'container': 'test-overcloud', + workflow_input={'container': 'test-overcloud', 'generate_passwords': False}) diff --git a/tripleoclient/tests/workflows/test_support.py b/tripleoclient/tests/workflows/test_support.py index 62b11e12a..2b2c20afa 100644 --- a/tripleoclient/tests/workflows/test_support.py +++ b/tripleoclient/tests/workflows/test_support.py @@ -33,10 +33,6 @@ class TestSupportFetchLogs(fakes.TestDeployOvercloud): self.tripleoclient.messaging_websocket.return_value = self.websocket self.app.client_manager.tripleoclient = self.tripleoclient - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - @mock.patch('tripleoclient.workflows.base.wait_for_messages') @mock.patch('tripleoclient.workflows.base.start_workflow') def test_fetch_logs(self, start_wf_mock, messages_mock): @@ -44,8 +40,7 @@ class TestSupportFetchLogs(fakes.TestDeployOvercloud): fetch_name = 'tripleo.support.v1.fetch_logs' fetch_input = { 'server_name': 'test', - 'container': 'test', - 'queue_name': 'UUID4' + 'container': 'test' } support.fetch_logs(self.app.client_manager, 'test', 'test') start_wf_mock.assert_called_once_with(self.workflow, @@ -60,8 +55,7 @@ class TestSupportFetchLogs(fakes.TestDeployOvercloud): fetch_input = { 'server_name': 'test', 'container': 'test', - 'queue_name': 'UUID4', - 'timeout': 59, + 'timeout': 59 } support.fetch_logs(self.app.client_manager, 'test', 'test', timeout=59) start_wf_mock.assert_called_once_with(self.workflow, @@ -76,8 +70,7 @@ class TestSupportFetchLogs(fakes.TestDeployOvercloud): fetch_input = { 'server_name': 'test', 'container': 'test', - 'queue_name': 'UUID4', - 'concurrency': 10, + 'concurrency': 10 } support.fetch_logs(self.app.client_manager, 'test', 'test', concurrency=10) @@ -99,18 +92,13 @@ class TestSupportDeleteContainer(fakes.TestDeployOvercloud): self.tripleoclient.messaging_websocket.return_value = self.websocket self.app.client_manager.tripleoclient = self.tripleoclient - uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") - self.mock_uuid4 = uuid4_patcher.start() - self.addCleanup(self.mock_uuid4.stop) - @mock.patch('tripleoclient.workflows.base.wait_for_messages') @mock.patch('tripleoclient.workflows.base.start_workflow') def test_delete_container(self, start_wf_mock, messages_mock): messages_mock.return_value = [] fetch_name = 'tripleo.support.v1.delete_container' fetch_input = { - 'container': 'test', - 'queue_name': 'UUID4' + 'container': 'test' } support.delete_container(self.app.client_manager, 'test') start_wf_mock.assert_called_once_with(self.workflow, @@ -124,8 +112,7 @@ class TestSupportDeleteContainer(fakes.TestDeployOvercloud): fetch_name = 'tripleo.support.v1.delete_container' fetch_input = { 'container': 'test', - 'queue_name': 'UUID4', - 'timeout': 59, + 'timeout': 59 } support.delete_container(self.app.client_manager, 'test', timeout=59) start_wf_mock.assert_called_once_with(self.workflow, @@ -140,8 +127,7 @@ class TestSupportDeleteContainer(fakes.TestDeployOvercloud): fetch_name = 'tripleo.support.v1.delete_container' fetch_input = { 'container': 'test', - 'queue_name': 'UUID4', - 'concurrency': 10, + 'concurrency': 10 } support.delete_container(self.app.client_manager, 'test', concurrency=10) diff --git a/tripleoclient/v1/baremetal.py b/tripleoclient/v1/baremetal.py index d4a50ea62..eb01be85b 100644 --- a/tripleoclient/v1/baremetal.py +++ b/tripleoclient/v1/baremetal.py @@ -19,7 +19,6 @@ import argparse import logging import simplejson import time -import uuid import ironic_inspector_client from osc_lib.command import command @@ -178,8 +177,6 @@ class ImportBaremetal(command.Command): _("OS_BAREMETAL_API_VERSION must be >=1.11 for use of " "'enroll' provision state; currently %s") % api_version) - queue_name = str(uuid.uuid4()) - if parsed_args.no_deploy_image: deploy_kernel = None deploy_ramdisk = None @@ -190,7 +187,6 @@ class ImportBaremetal(command.Command): baremetal.register_or_update( self.app.client_manager, nodes_json=nodes_config, - queue_name=queue_name, kernel_name=deploy_kernel, ramdisk_name=deploy_ramdisk, instance_boot_option=parsed_args.instance_boot_option, @@ -224,7 +220,6 @@ class StartBaremetalIntrospectionBulk(command.Command): 'overcloud node introspect" to introspect manageable ' 'nodes instead.') - queue_name = str(uuid.uuid4()) clients = self.app.client_manager client = self.app.client_manager.baremetal @@ -242,13 +237,12 @@ class StartBaremetalIntrospectionBulk(command.Command): print("Starting introspection of manageable nodes") baremetal.introspect_manageable_nodes( clients, - run_validations=parsed_args.run_validations, - queue_name=queue_name) - + run_validations=parsed_args.run_validations + ) print("Setting manageable nodes to available...") self.log.debug("Moving manageable nodes to available state.") - baremetal.provide_manageable_nodes(clients, queue_name=queue_name) + baremetal.provide_manageable_nodes(clients) class StatusBaremetalIntrospectionBulk(command.Lister): @@ -417,7 +411,6 @@ class ConfigureBaremetalBoot(command.Command): 'overcloud node configure" to configure manageable ' 'nodes instead.') - queue_name = str(uuid.uuid4()) bm_client = self.app.client_manager.baremetal for node in bm_client.node.list(maintenance=False): @@ -445,7 +438,6 @@ class ConfigureBaremetalBoot(command.Command): baremetal.configure( self.app.client_manager, node_uuids=[node.uuid], - queue_name=queue_name, kernel_name=parsed_args.deploy_kernel, ramdisk_name=parsed_args.deploy_ramdisk, root_device=parsed_args.root_device, diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index 36a417cd7..c773756a3 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -22,7 +22,6 @@ import re import shutil import six import tempfile -import uuid import yaml from heatclient.common import template_utils @@ -519,8 +518,8 @@ class DeployOvercloud(command.Command): if self._password_cache is None: self._password_cache = workflow_params.get_overcloud_passwords( self.clients, - container=stack_name, - queue_name=str(uuid.uuid4())) + container=stack_name + ) return self._password_cache[password_name] @@ -688,7 +687,6 @@ class DeployOvercloud(command.Command): 'parameters': parameters, 'default_role_counts': self._get_default_role_counts(parsed_args), 'run_validations': True, - 'queue_name': str(uuid.uuid4()), } errors, warnings = validations.check_predeployment_validations( diff --git a/tripleoclient/v1/overcloud_execute.py b/tripleoclient/v1/overcloud_execute.py index 324d1a739..b90bf3d4a 100644 --- a/tripleoclient/v1/overcloud_execute.py +++ b/tripleoclient/v1/overcloud_execute.py @@ -17,7 +17,6 @@ import argparse import logging import os.path import re -import uuid from osc_lib.command import command @@ -44,8 +43,7 @@ class RemoteExecute(command.Command): config = parsed_args.file_in.read() workflow_client = self.app.client_manager.workflow_engine tripleoclients = self.app.client_manager.tripleoclient - queue_name = str(uuid.uuid4()) - messaging_websocket = tripleoclients.messaging_websocket(queue_name) + messaging_websocket = tripleoclients.messaging_websocket() # no special characters here config_name = re.sub('[^\w]*', '', @@ -58,8 +56,7 @@ class RemoteExecute(command.Command): 'server_name': parsed_args.server_name, 'config_name': config_name, 'group': parsed_args.group, - 'config': config, - 'queue_name': queue_name + 'config': config } workflow_client.executions.create( diff --git a/tripleoclient/v1/overcloud_node.py b/tripleoclient/v1/overcloud_node.py index e354f8ec9..1d7f54235 100644 --- a/tripleoclient/v1/overcloud_node.py +++ b/tripleoclient/v1/overcloud_node.py @@ -15,7 +15,6 @@ import argparse import logging -import uuid from osc_lib.command import command from osc_lib.i18n import _ @@ -104,15 +103,11 @@ class ProvideNode(command.Command): def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) - queue_name = str(uuid.uuid4()) - if parsed_args.node_uuids: baremetal.provide(self.app.client_manager, - node_uuids=parsed_args.node_uuids, - queue_name=queue_name) + node_uuids=parsed_args.node_uuids) else: - baremetal.provide_manageable_nodes(self.app.client_manager, - queue_name=queue_name) + baremetal.provide_manageable_nodes(self.app.client_manager) class IntrospectNode(command.Command): @@ -147,28 +142,26 @@ class IntrospectNode(command.Command): def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) - queue_name = str(uuid.uuid4()) nodes = parsed_args.node_uuids if nodes: baremetal.introspect(self.app.client_manager, node_uuids=nodes, - run_validations=parsed_args.run_validations, - queue_name=queue_name) + run_validations=parsed_args.run_validations + ) else: baremetal.introspect_manageable_nodes( self.app.client_manager, - run_validations=parsed_args.run_validations, - queue_name=queue_name) + run_validations=parsed_args.run_validations + ) if parsed_args.provide: if nodes: baremetal.provide(self.app.client_manager, node_uuids=nodes, - queue_name=queue_name) + ) else: - baremetal.provide_manageable_nodes(self.app.client_manager, - queue_name=queue_name) + baremetal.provide_manageable_nodes(self.app.client_manager) class ImportNode(command.Command): @@ -208,8 +201,6 @@ class ImportNode(command.Command): nodes_config = oooutils.parse_env_file(parsed_args.env_file) - queue_name = str(uuid.uuid4()) - if parsed_args.no_deploy_image: deploy_kernel = None deploy_ramdisk = None @@ -220,7 +211,6 @@ class ImportNode(command.Command): nodes = baremetal.register_or_update( self.app.client_manager, nodes_json=nodes_config, - queue_name=queue_name, kernel_name=deploy_kernel, ramdisk_name=deploy_ramdisk, instance_boot_option=parsed_args.instance_boot_option @@ -231,13 +221,13 @@ class ImportNode(command.Command): if parsed_args.introspect: baremetal.introspect(self.app.client_manager, node_uuids=nodes_uuids, - run_validations=parsed_args.run_validations, - queue_name=queue_name) + run_validations=parsed_args.run_validations + ) if parsed_args.provide: baremetal.provide(self.app.client_manager, node_uuids=nodes_uuids, - queue_name=queue_name) + ) class ConfigureNode(command.Command): @@ -289,13 +279,10 @@ class ConfigureNode(command.Command): def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) - queue_name = str(uuid.uuid4()) - if parsed_args.node_uuids: baremetal.configure( self.app.client_manager, node_uuids=parsed_args.node_uuids, - queue_name=queue_name, kernel_name=parsed_args.deploy_kernel, ramdisk_name=parsed_args.deploy_ramdisk, instance_boot_option=parsed_args.instance_boot_option, @@ -307,7 +294,6 @@ class ConfigureNode(command.Command): else: baremetal.configure_manageable_nodes( self.app.client_manager, - queue_name=queue_name, kernel_name=parsed_args.deploy_kernel, ramdisk_name=parsed_args.deploy_ramdisk, instance_boot_option=parsed_args.instance_boot_option, @@ -358,8 +344,6 @@ class DiscoverNode(command.Command): def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) - queue_name = str(uuid.uuid4()) - if parsed_args.no_deploy_image: deploy_kernel = None deploy_ramdisk = None @@ -377,7 +361,6 @@ class DiscoverNode(command.Command): self.app.client_manager, ip_addresses=parsed_args.ip_addresses, credentials=credentials, - queue_name=queue_name, kernel_name=deploy_kernel, ramdisk_name=deploy_ramdisk, instance_boot_option=parsed_args.instance_boot_option, @@ -389,10 +372,9 @@ class DiscoverNode(command.Command): if parsed_args.introspect: baremetal.introspect(self.app.client_manager, node_uuids=nodes_uuids, - run_validations=parsed_args.run_validations, - queue_name=queue_name) - + run_validations=parsed_args.run_validations + ) if parsed_args.provide: baremetal.provide(self.app.client_manager, - node_uuids=nodes_uuids, - queue_name=queue_name) + node_uuids=nodes_uuids + ) diff --git a/tripleoclient/v1/overcloud_plan.py b/tripleoclient/v1/overcloud_plan.py index cf097d192..de3358591 100644 --- a/tripleoclient/v1/overcloud_plan.py +++ b/tripleoclient/v1/overcloud_plan.py @@ -13,7 +13,6 @@ import json import logging import os.path -import uuid from osc_lib.command import command from osc_lib.i18n import _ @@ -135,8 +134,9 @@ class CreatePlan(command.Command): plan_env_file=parsed_args.plan_environment_file) else: plan_management.create_deployment_plan( - clients, container=name, queue_name=str(uuid.uuid4()), - generate_passwords=generate_passwords, source_url=source_url, + clients, container=name, + generate_passwords=generate_passwords, + source_url=source_url, use_default_templates=use_default_templates) @@ -201,7 +201,9 @@ class ExportPlan(command.Command): print("Exporting plan %s..." % plan) tempurl = plan_management.export_deployment_plan( - self.app.client_manager, plan=plan, queue_name=str(uuid.uuid4())) + self.app.client_manager, + plan=plan + ) f = request.urlopen(tempurl) tarball_contents = f.read() diff --git a/tripleoclient/v1/overcloud_raid.py b/tripleoclient/v1/overcloud_raid.py index d571547d9..7305ea62c 100644 --- a/tripleoclient/v1/overcloud_raid.py +++ b/tripleoclient/v1/overcloud_raid.py @@ -18,7 +18,6 @@ import os from osc_lib.command import command from osc_lib.i18n import _ -import uuid import yaml from tripleoclient.workflows import baremetal @@ -71,9 +70,7 @@ class CreateRAID(command.Command): _('Logical disks list is expected to be a list of objects, ' 'got %r instead') % disks) - queue_name = str(uuid.uuid4()) clients = self.app.client_manager baremetal.create_raid_configuration(clients, - queue_name=queue_name, node_uuids=parsed_args.node, configuration=configuration) diff --git a/tripleoclient/v1/overcloud_update.py b/tripleoclient/v1/overcloud_update.py index 09c39db1b..5f57571df 100644 --- a/tripleoclient/v1/overcloud_update.py +++ b/tripleoclient/v1/overcloud_update.py @@ -15,9 +15,9 @@ import logging import os -import uuid import yaml + from osc_lib.command import command from osc_lib.i18n import _ from oslo_concurrency import processutils @@ -106,8 +106,8 @@ class UpdateOvercloud(command.Command): "to update your current containers deployed.") # Execute minor update package_update.update(clients, container=stack_name, - container_registry=registry, - queue_name=str(uuid.uuid4())) + container_registry=registry + ) print("Minor update init on stack {0} complete.".format( parsed_args.stack)) @@ -134,6 +134,6 @@ class UpdateOvercloud(command.Command): output = package_update.update_ansible( clients, nodes=nodes, inventory_file=inventory, - playbook=playbook, - queue_name=str(uuid.uuid4())) + playbook=playbook + ) print(output) diff --git a/tripleoclient/workflows/baremetal.py b/tripleoclient/workflows/baremetal.py index 9ade0dcfe..e0a24c0fc 100644 --- a/tripleoclient/workflows/baremetal.py +++ b/tripleoclient/workflows/baremetal.py @@ -26,9 +26,8 @@ def register_or_update(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.register_or_update', @@ -72,14 +71,12 @@ def provide(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.provide', - workflow_input={'node_uuids': workflow_input['node_uuids'], - 'queue_name': queue_name} + workflow_input={'node_uuids': workflow_input['node_uuids']} ) for payload in base.wait_for_messages(workflow_client, ws, execution): @@ -103,19 +100,16 @@ def introspect(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] print("Waiting for introspection to finish...") - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.introspect', workflow_input={ 'node_uuids': workflow_input['node_uuids'], - 'run_validations': workflow_input['run_validations'], - 'queue_name': queue_name - } + 'run_validations': workflow_input['run_validations']} ) for payload in base.wait_for_messages(workflow_client, ws, execution): @@ -136,20 +130,17 @@ def introspect_manageable_nodes(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] print("Waiting for introspection to finish...") errors = [] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.introspect_manageable_nodes', workflow_input={ - 'run_validations': workflow_input['run_validations'], - 'queue_name': queue_name, - } + 'run_validations': workflow_input['run_validations']} ) for payload in base.wait_for_messages(workflow_client, ws, execution): @@ -181,13 +172,12 @@ def provide_manageable_nodes(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.provide_manageable_nodes', - workflow_input={"queue_name": queue_name, } + workflow_input=workflow_input ) for payload in base.wait_for_messages(workflow_client, ws, execution): @@ -209,9 +199,8 @@ def configure(clients, **workflow_input): workflow_client = clients.workflow_engine ooo_client = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with ooo_client.messaging_websocket(queue_name) as ws: + with ooo_client.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.configure', @@ -235,9 +224,8 @@ def configure_manageable_nodes(clients, **workflow_input): workflow_client = clients.workflow_engine ooo_client = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with ooo_client.messaging_websocket(queue_name) as ws: + with ooo_client.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.configure_manageable_nodes', @@ -263,11 +251,10 @@ def create_raid_configuration(clients, **workflow_input): workflow_client = clients.workflow_engine ooo_client = clients.tripleoclient - queue_name = workflow_input['queue_name'] print('Creating RAID configuration for given nodes, this may take time') - with ooo_client.messaging_websocket(queue_name) as ws: + with ooo_client.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.create_raid_configuration', @@ -293,9 +280,8 @@ def discover_and_enroll(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.baremetal.v1.discover_and_enroll_nodes', diff --git a/tripleoclient/workflows/deployment.py b/tripleoclient/workflows/deployment.py index 7ec4be719..576f68012 100644 --- a/tripleoclient/workflows/deployment.py +++ b/tripleoclient/workflows/deployment.py @@ -13,7 +13,6 @@ from __future__ import print_function import pprint import time -import uuid from heatclient.common import event_utils from openstackclient import shell @@ -28,9 +27,8 @@ def deploy(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.deployment.v1.deploy_plan', @@ -53,8 +51,7 @@ def deploy_and_wait(log, clients, stack, plan_name, verbose_level, workflow_input = { "container": plan_name, "run_validations": run_validations, - "skip_deploy_identifier": skip_deploy_identifier, - "queue_name": str(uuid.uuid4()), + "skip_deploy_identifier": skip_deploy_identifier } if timeout is not None: diff --git a/tripleoclient/workflows/package_update.py b/tripleoclient/workflows/package_update.py index b9bedd4e5..7dcd60df2 100644 --- a/tripleoclient/workflows/package_update.py +++ b/tripleoclient/workflows/package_update.py @@ -14,6 +14,7 @@ from __future__ import print_function import pprint import time + from heatclient.common import event_utils from openstackclient import shell from tripleoclient import exceptions @@ -25,10 +26,9 @@ from tripleoclient.workflows import base def update(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] plan_name = workflow_input['container'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.package_update.v1.package_update_plan', @@ -57,9 +57,8 @@ def update(clients, **workflow_input): def update_ansible(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.package_update.v1.update_nodes', diff --git a/tripleoclient/workflows/parameters.py b/tripleoclient/workflows/parameters.py index e54989fa1..7d724da67 100644 --- a/tripleoclient/workflows/parameters.py +++ b/tripleoclient/workflows/parameters.py @@ -9,7 +9,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -import uuid import yaml from tripleoclient import exceptions @@ -31,9 +30,8 @@ def get_overcloud_passwords(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.plan_management.v1.get_passwords', @@ -63,14 +61,10 @@ def invoke_plan_env_workflows(clients, stack_name, plan_env_file): for wf_name, wf_inputs in plan_env_data["workflow_parameters"].items(): print('Invoking workflow (%s) specified in plan-environment ' 'file' % wf_name) - inputs = {} - inputs['plan'] = stack_name - queue_name = str(uuid.uuid4()) - inputs['queue_name'] = queue_name - inputs['user_inputs'] = wf_inputs + inputs = {'plan': stack_name, 'user_inputs': wf_inputs} workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, wf_name, @@ -101,13 +95,11 @@ def check_deprecated_parameters(clients, container): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = str(uuid.uuid4()) workflow_input = { - 'container': container, - 'queue_name': queue_name + 'container': container } - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.plan_management.v1.get_deprecated_parameters', diff --git a/tripleoclient/workflows/plan_management.py b/tripleoclient/workflows/plan_management.py index 02a9beb1b..eaa2428b5 100644 --- a/tripleoclient/workflows/plan_management.py +++ b/tripleoclient/workflows/plan_management.py @@ -11,7 +11,6 @@ # under the License. import logging import tempfile -import uuid import yaml from swiftclient import exceptions as swift_exc @@ -67,9 +66,8 @@ def _upload_templates(swift_client, container_name, tht_root, roles_file=None, def _create_update_deployment_plan(clients, workflow, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, workflow, workflow_input=workflow_input @@ -144,7 +142,6 @@ def create_plan_from_templates(clients, name, tht_root, roles_file=None, try: create_deployment_plan(clients, container=name, - queue_name=str(uuid.uuid4()), generate_passwords=generate_passwords) except exceptions.WorkflowServiceError: swiftutils.delete_container(swift_client, name) @@ -188,7 +185,6 @@ def update_plan_from_templates(clients, name, tht_root, roles_file=None, networks_file) _update_passwords(swift_client, name, passwords) update_deployment_plan(clients, container=name, - queue_name=str(uuid.uuid4()), generate_passwords=generate_passwords, source_url=None) @@ -215,7 +211,6 @@ def _update_passwords(swift_client, name, passwords): def export_deployment_plan(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] execution = base.start_workflow( workflow_client, @@ -223,7 +218,7 @@ def export_deployment_plan(clients, **workflow_input): workflow_input=workflow_input ) - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: for payload in base.wait_for_messages(workflow_client, ws, execution, _WORKFLOW_TIMEOUT): if 'message' in payload: diff --git a/tripleoclient/workflows/scale.py b/tripleoclient/workflows/scale.py index 32466d85e..cf54d2fec 100644 --- a/tripleoclient/workflows/scale.py +++ b/tripleoclient/workflows/scale.py @@ -14,8 +14,6 @@ # under the License. from __future__ import print_function -import uuid - from tripleoclient.exceptions import InvalidConfiguration from tripleoclient.workflows import base @@ -24,9 +22,8 @@ def delete_node(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.scale.v1.delete_node', @@ -51,7 +48,6 @@ def scale_down(clients, plan_name, nodes, timeout=None): workflow_input = { "container": plan_name, "nodes": nodes, - "queue_name": str(uuid.uuid4()), } if timeout is not None: diff --git a/tripleoclient/workflows/stack_management.py b/tripleoclient/workflows/stack_management.py index bad8de426..3b78ad002 100644 --- a/tripleoclient/workflows/stack_management.py +++ b/tripleoclient/workflows/stack_management.py @@ -14,8 +14,6 @@ # under the License. from __future__ import print_function -import uuid - from tripleoclient.exceptions import InvalidConfiguration from tripleoclient.workflows import base @@ -31,13 +29,10 @@ def delete_stack(clients, stack): tripleoclient = clients.tripleoclient workflow_input = { - 'stack': stack, - 'queue_name': str(uuid.uuid4()), + 'stack': stack } - queue_name = workflow_input['queue_name'] - - with tripleoclient.messaging_websocket(queue_name) as ws: + with tripleoclient.messaging_websocket() as ws: execution = base.start_workflow( workflow_client, 'tripleo.stack.v1.delete_stack', diff --git a/tripleoclient/workflows/support.py b/tripleoclient/workflows/support.py index 0a8be5307..e8b7f2009 100644 --- a/tripleoclient/workflows/support.py +++ b/tripleoclient/workflows/support.py @@ -14,7 +14,6 @@ # import os -import uuid from osc_lib.i18n import _ @@ -74,7 +73,6 @@ def fetch_logs(clients, container, server_name, timeout=None, workflow_input = { "container": container, "server_name": server_name, - "queue_name": str(uuid.uuid4()), } if timeout is not None: @@ -84,7 +82,6 @@ def fetch_logs(clients, container, server_name, timeout=None, workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] execution = base.start_workflow( workflow_client, @@ -92,7 +89,7 @@ def fetch_logs(clients, container, server_name, timeout=None, workflow_input=workflow_input ) - websocket = tripleoclients.messaging_websocket(queue_name) + websocket = tripleoclients.messaging_websocket() messages = base.wait_for_messages(workflow_client, websocket, execution, @@ -115,7 +112,6 @@ def delete_container(clients, container, timeout=None, concurrency=None): """ workflow_input = { "container": container, - "queue_name": str(uuid.uuid4()), } if timeout is not None: @@ -125,7 +121,6 @@ def delete_container(clients, container, timeout=None, concurrency=None): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] execution = base.start_workflow( workflow_client, @@ -133,7 +128,7 @@ def delete_container(clients, container, timeout=None, concurrency=None): workflow_input=workflow_input ) - websocket = tripleoclients.messaging_websocket(queue_name) + websocket = tripleoclients.messaging_websocket() messages = base.wait_for_messages(workflow_client, websocket, execution, diff --git a/tripleoclient/workflows/validations.py b/tripleoclient/workflows/validations.py index d33891f7f..5c5cca474 100644 --- a/tripleoclient/workflows/validations.py +++ b/tripleoclient/workflows/validations.py @@ -15,7 +15,6 @@ from tripleoclient.workflows import base def check_predeployment_validations(clients, **workflow_input): workflow_client = clients.workflow_engine tripleoclients = clients.tripleoclient - queue_name = workflow_input['queue_name'] execution = base.start_workflow( workflow_client, @@ -25,7 +24,7 @@ def check_predeployment_validations(clients, **workflow_input): errors = [] warnings = [] - with tripleoclients.messaging_websocket(queue_name) as ws: + with tripleoclients.messaging_websocket() as ws: for payload in base.wait_for_messages(workflow_client, ws, execution): if payload.get('message'): print(payload['message'])