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
This commit is contained in:
Toure Dunnon 2017-10-05 16:48:39 -04:00
parent 79cbcddd7e
commit 1bd1620ead
31 changed files with 141 additions and 336 deletions

View File

@ -67,7 +67,7 @@ def build_option_parser(parser):
class WebsocketClient(object): class WebsocketClient(object):
def __init__(self, instance, queue_name): def __init__(self, instance, queue_name="tripleo"):
self._project_id = None self._project_id = None
self._ws = None self._ws = None
self._websocket_client_id = None self._websocket_client_id = None
@ -195,9 +195,9 @@ class ClientWrapper(object):
self._local_orchestration = client self._local_orchestration = client
return self._local_orchestration return self._local_orchestration
def messaging_websocket(self, queue_name='tripleo'): def messaging_websocket(self):
"""Returns a websocket for the messaging service""" """Returns a websocket for the messaging service"""
return WebsocketClient(self._instance, queue_name) return WebsocketClient(self._instance)
@property @property
def object_store(self): def object_store(self):

View File

@ -62,5 +62,5 @@ class FakeClientWrapper(object):
def __init__(self): def __init__(self):
self.ws = FakeWebSocket() self.ws = FakeWebSocket()
def messaging_websocket(self, queue_name="tripleo"): def messaging_websocket(self):
return self.ws return self.ws

View File

@ -103,7 +103,7 @@ class ClientWrapper(object):
return_value=self._mock_websocket) return_value=self._mock_websocket)
self._mock_websocket.__exit__ = mock.Mock() self._mock_websocket.__exit__ = mock.Mock()
def messaging_websocket(self, queue_name='tripleo'): def messaging_websocket(self):
return self._mock_websocket return self._mock_websocket

View File

@ -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 websocket.wait_for_messages.return_value = self.mock_websocket_success
self.websocket = 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)
def tearDown(self): def tearDown(self):
super(TestImportBaremetal, self).tearDown() 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={ 'tripleo.baremetal.v1.register_or_update', workflow_input={
'kernel_name': kernel_name, 'kernel_name': kernel_name,
'nodes_json': self.nodes_list, 'nodes_json': self.nodes_list,
'queue_name': 'UUID4',
'ramdisk_name': ramdisk_name, 'ramdisk_name': ramdisk_name,
'instance_boot_option': 'local' if local else 'netboot', 'instance_boot_option': 'local' if local else 'netboot',
'initial_state': 'available', 'initial_state': 'available',
@ -596,10 +591,6 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
websocket = tripleoclients.messaging_websocket() websocket = tripleoclients.messaging_websocket()
self.websocket = 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 # Get the command object to test
self.cmd = baremetal.StartBaremetalIntrospectionBulk(self.app, None) self.cmd = baremetal.StartBaremetalIntrospectionBulk(self.app, None)
@ -609,14 +600,13 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
'tripleo.baremetal.v1.introspect_manageable_nodes', 'tripleo.baremetal.v1.introspect_manageable_nodes',
workflow_input={ workflow_input={
'run_validations': False, 'run_validations': False,
'queue_name': 'UUID4'
} }
)] )]
if provide: if provide:
call_list.append(mock.call( call_list.append(mock.call(
'tripleo.baremetal.v1.provide_manageable_nodes', 'tripleo.baremetal.v1.provide_manageable_nodes',
workflow_input={'queue_name': 'UUID4'} workflow_input={}
)) ))
self.workflow.executions.create.assert_has_calls(call_list) self.workflow.executions.create.assert_has_calls(call_list)
@ -900,12 +890,7 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal):
"message": "" "message": ""
}] * 2) }] * 2)
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4") self.workflow_input = {'node_uuids': ['ABCDEFGH'],
self.mock_uuid4 = uuid4_patcher.start()
self.addCleanup(self.mock_uuid4.stop)
self.workflow_input = {'queue_name': 'UUID4',
'node_uuids': ['ABCDEFGH'],
'kernel_name': 'bm-deploy-kernel', 'kernel_name': 'bm-deploy-kernel',
'ramdisk_name': 'bm-deploy-ramdisk', 'ramdisk_name': 'bm-deploy-ramdisk',
'root_device': None, 'root_device': None,

View File

@ -110,7 +110,7 @@ class FakeClientWrapper(object):
self._instance = mock.Mock() self._instance = mock.Mock()
self.object_store = FakeObjectClient() self.object_store = FakeObjectClient()
def messaging_websocket(self, queue_name="tripleo"): def messaging_websocket(self):
return fakes.FakeWebSocket() return fakes.FakeWebSocket()

View File

@ -26,7 +26,7 @@ class FakeClientWrapper(object):
return_value=self._mock_websocket) return_value=self._mock_websocket)
self._mock_websocket.__exit__ = mock.Mock() self._mock_websocket.__exit__ = mock.Mock()
def messaging_websocket(self, queue_name='tripleo'): def messaging_websocket(self):
return self._mock_websocket return self._mock_websocket
@ -48,7 +48,3 @@ class TestOvercloudNode(utils.TestCommand):
self.app.client_manager.baremetal = mock.Mock() self.app.client_manager.baremetal = mock.Mock()
self.app.client_manager.workflow_engine = mock.Mock() self.app.client_manager.workflow_engine = mock.Mock()
self.app.client_manager.tripleoclient = FakeClientWrapper() 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)

View File

@ -47,11 +47,6 @@ class TestDeleteNode(fakes.TestDeleteNode):
self.stack_name = self.app.client_manager.orchestration.stacks.get self.stack_name = self.app.client_manager.orchestration.stacks.get
self.stack_name.return_value = mock.Mock(stack_name="overcloud") 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 # TODO(someone): This test does not pass with autospec=True, it should
# probably be fixed so that it can pass with that. # probably be fixed so that it can pass with that.
def test_node_delete(self): def test_node_delete(self):
@ -77,7 +72,6 @@ class TestDeleteNode(fakes.TestDeleteNode):
'tripleo.scale.v1.delete_node', 'tripleo.scale.v1.delete_node',
workflow_input={ workflow_input={
'container': 'overcast', 'container': 'overcast',
'queue_name': 'UUID4',
'nodes': ['instance1', 'instance2'] 'nodes': ['instance1', 'instance2']
}) })
@ -121,7 +115,6 @@ class TestDeleteNode(fakes.TestDeleteNode):
'tripleo.scale.v1.delete_node', 'tripleo.scale.v1.delete_node',
workflow_input={ workflow_input={
'container': 'overcloud', 'container': 'overcloud',
'queue_name': 'UUID4',
'nodes': ['instance1', ] 'nodes': ['instance1', ]
}) })
@ -149,7 +142,6 @@ class TestDeleteNode(fakes.TestDeleteNode):
'tripleo.scale.v1.delete_node', 'tripleo.scale.v1.delete_node',
workflow_input={ workflow_input={
'container': 'overcloud', 'container': 'overcloud',
'queue_name': 'UUID4',
'nodes': ['wrong_instance', ] 'nodes': ['wrong_instance', ]
}) })
@ -180,7 +172,7 @@ class TestProvideNode(fakes.TestOvercloudNode):
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.provide_manageable_nodes', 'tripleo.baremetal.v1.provide_manageable_nodes',
workflow_input={'queue_name': 'UUID4'} workflow_input={}
) )
def test_provide_one_node(self): def test_provide_one_node(self):
@ -192,9 +184,8 @@ class TestProvideNode(fakes.TestOvercloudNode):
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.provide', workflow_input={ 'tripleo.baremetal.v1.provide',
'node_uuids': [node_id], workflow_input={'node_uuids': [node_id]}
'queue_name': 'UUID4'}
) )
def test_provide_multiple_nodes(self): def test_provide_multiple_nodes(self):
@ -209,8 +200,7 @@ class TestProvideNode(fakes.TestOvercloudNode):
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.provide', workflow_input={ 'tripleo.baremetal.v1.provide', workflow_input={
'node_uuids': [node_id1, node_id2], 'node_uuids': [node_id1, node_id2]
'queue_name': 'UUID4'
} }
) )
@ -251,16 +241,13 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
call_list = [mock.call( call_list = [mock.call(
'tripleo.baremetal.v1.introspect_manageable_nodes', 'tripleo.baremetal.v1.introspect_manageable_nodes',
workflow_input={ workflow_input={'run_validations': False}
'run_validations': False,
'queue_name': 'UUID4'
}
)] )]
if provide: if provide:
call_list.append(mock.call( call_list.append(mock.call(
'tripleo.baremetal.v1.provide_manageable_nodes', 'tripleo.baremetal.v1.provide_manageable_nodes',
workflow_input={'queue_name': 'UUID4'} workflow_input={}
)) ))
self.workflow.executions.create.assert_has_calls(call_list) self.workflow.executions.create.assert_has_calls(call_list)
@ -278,15 +265,13 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
call_list = [mock.call( call_list = [mock.call(
'tripleo.baremetal.v1.introspect', workflow_input={ 'tripleo.baremetal.v1.introspect', workflow_input={
'node_uuids': nodes, 'node_uuids': nodes,
'run_validations': False, 'run_validations': False}
'queue_name': 'UUID4'}
)] )]
if provide: if provide:
call_list.append(mock.call( call_list.append(mock.call(
'tripleo.baremetal.v1.provide', workflow_input={ 'tripleo.baremetal.v1.provide', workflow_input={
'node_uuids': nodes, 'node_uuids': nodes}
'queue_name': 'UUID4'}
)) ))
self.workflow.executions.create.assert_has_calls(call_list) self.workflow.executions.create.assert_has_calls(call_list)
@ -391,7 +376,6 @@ class TestImportNode(fakes.TestOvercloudNode):
call_list = [mock.call( call_list = [mock.call(
'tripleo.baremetal.v1.register_or_update', workflow_input={ 'tripleo.baremetal.v1.register_or_update', workflow_input={
'nodes_json': nodes_list, 'nodes_json': nodes_list,
'queue_name': 'UUID4',
'kernel_name': None if no_deploy_image else 'bm-deploy-kernel', 'kernel_name': None if no_deploy_image else 'bm-deploy-kernel',
'ramdisk_name': (None 'ramdisk_name': (None
if no_deploy_image else 'bm-deploy-ramdisk'), if no_deploy_image else 'bm-deploy-ramdisk'),
@ -404,16 +388,14 @@ class TestImportNode(fakes.TestOvercloudNode):
call_list.append(mock.call( call_list.append(mock.call(
'tripleo.baremetal.v1.introspect', workflow_input={ 'tripleo.baremetal.v1.introspect', workflow_input={
'node_uuids': ['MOCK_NODE_UUID'], 'node_uuids': ['MOCK_NODE_UUID'],
'run_validations': False, 'run_validations': False}
'queue_name': 'UUID4'}
)) ))
if provide: if provide:
call_count += 1 call_count += 1
call_list.append(mock.call( call_list.append(mock.call(
'tripleo.baremetal.v1.provide', workflow_input={ 'tripleo.baremetal.v1.provide', workflow_input={
'node_uuids': ['MOCK_NODE_UUID'], 'node_uuids': ['MOCK_NODE_UUID']
'queue_name': 'UUID4'
} }
)) ))
@ -484,8 +466,7 @@ class TestConfigureNode(fakes.TestOvercloudNode):
# Get the command object to test # Get the command object to test
self.cmd = overcloud_node.ConfigureNode(self.app, None) self.cmd = overcloud_node.ConfigureNode(self.app, None)
self.workflow_input = {'queue_name': 'UUID4', self.workflow_input = {'kernel_name': 'bm-deploy-kernel',
'kernel_name': 'bm-deploy-kernel',
'ramdisk_name': 'bm-deploy-ramdisk', 'ramdisk_name': 'bm-deploy-ramdisk',
'instance_boot_option': None, 'instance_boot_option': None,
'root_device': None, 'root_device': None,
@ -673,7 +654,6 @@ class TestDiscoverNode(fakes.TestOvercloudNode):
'tripleo.baremetal.v1.discover_and_enroll_nodes', 'tripleo.baremetal.v1.discover_and_enroll_nodes',
workflow_input={'ip_addresses': '10.0.0.0/24', workflow_input={'ip_addresses': '10.0.0.0/24',
'credentials': [['admin', 'password']], 'credentials': [['admin', 'password']],
'queue_name': mock.ANY,
'kernel_name': 'bm-deploy-kernel', 'kernel_name': 'bm-deploy-kernel',
'ramdisk_name': 'bm-deploy-ramdisk', 'ramdisk_name': 'bm-deploy-ramdisk',
'instance_boot_option': 'local'} 'instance_boot_option': 'local'}
@ -692,7 +672,6 @@ class TestDiscoverNode(fakes.TestOvercloudNode):
'tripleo.baremetal.v1.discover_and_enroll_nodes', 'tripleo.baremetal.v1.discover_and_enroll_nodes',
workflow_input={'ip_addresses': ['10.0.0.1', '10.0.0.2'], workflow_input={'ip_addresses': ['10.0.0.1', '10.0.0.2'],
'credentials': [['admin', 'password']], 'credentials': [['admin', 'password']],
'queue_name': mock.ANY,
'kernel_name': 'bm-deploy-kernel', 'kernel_name': 'bm-deploy-kernel',
'ramdisk_name': 'bm-deploy-ramdisk', 'ramdisk_name': 'bm-deploy-ramdisk',
'instance_boot_option': 'local'} 'instance_boot_option': 'local'}
@ -723,16 +702,14 @@ class TestDiscoverNode(fakes.TestOvercloudNode):
'credentials': [['admin', 'password'], 'credentials': [['admin', 'password'],
['admin2', 'password2']], ['admin2', 'password2']],
'ports': [623, 6230], 'ports': [623, 6230],
'queue_name': mock.ANY,
'kernel_name': None, 'kernel_name': None,
'ramdisk_name': None, 'ramdisk_name': None,
'instance_boot_option': 'netboot'}), 'instance_boot_option': 'netboot'}),
mock.call('tripleo.baremetal.v1.introspect', mock.call('tripleo.baremetal.v1.introspect',
workflow_input={'node_uuids': ['MOCK_NODE_UUID'], workflow_input={'node_uuids': ['MOCK_NODE_UUID'],
'run_validations': True, 'run_validations': True}),
'queue_name': mock.ANY}),
mock.call('tripleo.baremetal.v1.provide', mock.call('tripleo.baremetal.v1.provide',
workflow_input={'node_uuids': ['MOCK_NODE_UUID'], workflow_input={'node_uuids': ['MOCK_NODE_UUID']}
'queue_name': mock.ANY}), )
] ]
self.workflow.executions.create.assert_has_calls(workflows_calls) self.workflow.executions.create.assert_has_calls(workflows_calls)

View File

@ -25,7 +25,7 @@ class FakeClientWrapper(object):
self._instance = mock.Mock() self._instance = mock.Mock()
self.object_store = FakeObjectClient() self.object_store = FakeObjectClient()
def messaging_websocket(self, queue_name="tripleo"): def messaging_websocket(self):
return fakes.FakeWebSocket() return fakes.FakeWebSocket()

View File

@ -14,7 +14,6 @@
# #
import mock import mock
import uuid
from tripleoclient import exceptions from tripleoclient import exceptions
from tripleoclient.tests.v1.overcloud_update import fakes from tripleoclient.tests.v1.overcloud_update import fakes
@ -64,8 +63,8 @@ class TestOvercloudUpdate(fakes.TestOvercloudUpdate):
mock_update.assert_called_once_with( mock_update.assert_called_once_with(
self.app.client_manager, self.app.client_manager,
container='mystack', container='mystack',
container_registry={'fake_container': 'fake_value'}, container_registry={'fake_container': 'fake_value'}
queue_name=str(uuid.uuid4())) )
@mock.patch('tripleoclient.workflows.package_update.update', @mock.patch('tripleoclient.workflows.package_update.update',
autospec=True) autospec=True)
@ -116,4 +115,4 @@ class TestOvercloudUpdate(fakes.TestOvercloudUpdate):
nodes='Compute', nodes='Compute',
inventory_file=mock_open().read(), inventory_file=mock_open().read(),
playbook='fake-playbook.yaml', playbook='fake-playbook.yaml',
queue_name=str(uuid.uuid4())) )

View File

@ -108,11 +108,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
self.workflow = self.app.client_manager.workflow_engine self.workflow = self.app.client_manager.workflow_engine
self.swift = self.app.client_manager.tripleoclient.object_store 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): def test_create_default_plan(self):
# Setup # Setup
@ -136,7 +131,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={ workflow_input={
'container': 'overcast', 'container': 'overcast',
'queue_name': 'UUID4',
'generate_passwords': True, 'generate_passwords': True,
'use_default_templates': True, 'use_default_templates': True,
'source_url': None 'source_url': None
@ -166,7 +160,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={ workflow_input={
'container': 'overcast', 'container': 'overcast',
'queue_name': 'UUID4',
'generate_passwords': True, 'generate_passwords': True,
'use_default_templates': True, 'use_default_templates': True,
'source_url': None 'source_url': None
@ -203,7 +196,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={ workflow_input={
'container': 'overcast', 'container': 'overcast',
'queue_name': 'UUID4',
'generate_passwords': True 'generate_passwords': True
}) })
@ -261,7 +253,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={ workflow_input={
'container': 'overcast', 'container': 'overcast',
'queue_name': 'UUID4',
'generate_passwords': True 'generate_passwords': True
}) })
@ -307,7 +298,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={ workflow_input={
'container': 'overcast', 'container': 'overcast',
'queue_name': 'UUID4',
'generate_passwords': True 'generate_passwords': True
}) })
@ -341,7 +331,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={ workflow_input={
'container': 'overcast', 'container': 'overcast',
'queue_name': 'UUID4',
'use_default_templates': True, 'use_default_templates': True,
'generate_passwords': False, 'generate_passwords': False,
'source_url': None 'source_url': None
@ -367,11 +356,6 @@ class TestOvercloudDeployPlan(utils.TestCommand):
self.tripleoclient.messaging_websocket.return_value = self.websocket self.tripleoclient.messaging_websocket.return_value = self.websocket
self.app.client_manager.tripleoclient = self.tripleoclient 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') sleep_patch = mock.patch('time.sleep')
self.addCleanup(sleep_patch.stop) self.addCleanup(sleep_patch.stop)
sleep_patch.start() sleep_patch.start()
@ -406,7 +390,6 @@ class TestOvercloudDeployPlan(utils.TestCommand):
workflow_input={ workflow_input={
'container': 'overcast', 'container': 'overcast',
'run_validations': True, 'run_validations': True,
'queue_name': 'UUID4',
'skip_deploy_identifier': False 'skip_deploy_identifier': False
} }
) )
@ -420,11 +403,6 @@ class TestOvercloudExportPlan(utils.TestCommand):
self.app.client_manager = mock.Mock() self.app.client_manager = mock.Mock()
self.clients = self.app.client_manager 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 # Mock urlopen
f = mock.Mock() f = mock.Mock()
f.read.return_value = 'tarball contents' f.read.return_value = 'tarball contents'
@ -446,7 +424,7 @@ class TestOvercloudExportPlan(utils.TestCommand):
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
export_deployment_plan_mock.assert_called_once_with( 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') @mock.patch('os.path.exists')
def test_export_plan_outfile_exists(self, exists_mock): def test_export_plan_outfile_exists(self, exists_mock):
@ -478,4 +456,4 @@ class TestOvercloudExportPlan(utils.TestCommand):
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
export_deployment_plan_mock.assert_called_once_with( export_deployment_plan_mock.assert_called_once_with(
self.clients, plan='test-plan', queue_name='UUID4') self.clients, plan='test-plan')

View File

@ -63,7 +63,6 @@ class TestCreateRAID(fakes.TestBaremetal):
workflow_input={ workflow_input={
'node_uuids': ['uuid1', 'uuid2'], 'node_uuids': ['uuid1', 'uuid2'],
'configuration': self.conf, 'configuration': self.conf,
'queue_name': mock.ANY,
} }
) )
@ -85,7 +84,6 @@ class TestCreateRAID(fakes.TestBaremetal):
workflow_input={ workflow_input={
'node_uuids': ['uuid1', 'uuid2'], 'node_uuids': ['uuid1', 'uuid2'],
'configuration': self.conf, 'configuration': self.conf,
'queue_name': mock.ANY,
} }
) )

View File

@ -52,7 +52,6 @@ class TestBaremetalWorkflows(utils.TestCommand):
self.assertEqual(baremetal.register_or_update( self.assertEqual(baremetal.register_or_update(
self.app.client_manager, self.app.client_manager,
nodes_json=[], nodes_json=[],
queue_name="QUEUE_NAME",
kernel_name="kernel", kernel_name="kernel",
ramdisk_name="ramdisk" ramdisk_name="ramdisk"
), []) ), [])
@ -61,7 +60,6 @@ class TestBaremetalWorkflows(utils.TestCommand):
'tripleo.baremetal.v1.register_or_update', 'tripleo.baremetal.v1.register_or_update',
workflow_input={ workflow_input={
'kernel_name': 'kernel', 'kernel_name': 'kernel',
'queue_name': 'QUEUE_NAME',
'nodes_json': [], 'nodes_json': [],
'ramdisk_name': 'ramdisk' 'ramdisk_name': 'ramdisk'
}) })
@ -75,7 +73,6 @@ class TestBaremetalWorkflows(utils.TestCommand):
baremetal.register_or_update, baremetal.register_or_update,
self.app.client_manager, self.app.client_manager,
nodes_json=[], nodes_json=[],
queue_name="QUEUE_NAME",
kernel_name="kernel", kernel_name="kernel",
ramdisk_name="ramdisk" ramdisk_name="ramdisk"
) )
@ -84,7 +81,6 @@ class TestBaremetalWorkflows(utils.TestCommand):
'tripleo.baremetal.v1.register_or_update', 'tripleo.baremetal.v1.register_or_update',
workflow_input={ workflow_input={
'kernel_name': 'kernel', 'kernel_name': 'kernel',
'queue_name': 'QUEUE_NAME',
'nodes_json': [], 'nodes_json': [],
'ramdisk_name': 'ramdisk' 'ramdisk_name': 'ramdisk'
}) })
@ -93,14 +89,12 @@ class TestBaremetalWorkflows(utils.TestCommand):
self.websocket.wait_for_messages.return_value = self.message_success self.websocket.wait_for_messages.return_value = self.message_success
baremetal.provide(self.app.client_manager, node_uuids=[], baremetal.provide(self.app.client_manager, node_uuids=[])
queue_name="QUEUE_NAME")
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.provide', 'tripleo.baremetal.v1.provide',
workflow_input={ workflow_input={
'node_uuids': [], 'node_uuids': [],
'queue_name': "QUEUE_NAME"
}) })
def test_provide_error(self): def test_provide_error(self):
@ -111,14 +105,13 @@ class TestBaremetalWorkflows(utils.TestCommand):
exceptions.NodeProvideError, exceptions.NodeProvideError,
baremetal.provide, baremetal.provide,
self.app.client_manager, self.app.client_manager,
node_uuids=[], node_uuids=[]
queue_name="QUEUE_NAME") )
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.provide', 'tripleo.baremetal.v1.provide',
workflow_input={ workflow_input={
'node_uuids': [], 'node_uuids': [],
'queue_name': "QUEUE_NAME"
}) })
def test_format_provide_errors(self): def test_format_provide_errors(self):
@ -140,22 +133,21 @@ class TestBaremetalWorkflows(utils.TestCommand):
exceptions.NodeProvideError, exceptions.NodeProvideError,
baremetal.provide, baremetal.provide,
self.app.client_manager, self.app.client_manager,
node_uuids=[], node_uuids=[]
queue_name="QUEUE_NAME") )
def test_introspect_success(self): def test_introspect_success(self):
self.websocket.wait_for_messages.return_value = self.message_success self.websocket.wait_for_messages.return_value = self.message_success
baremetal.introspect(self.app.client_manager, node_uuids=[], 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( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.introspect', 'tripleo.baremetal.v1.introspect',
workflow_input={ workflow_input={
'node_uuids': [], 'node_uuids': [],
'run_validations': True, 'run_validations': True,
'queue_name': "QUEUE_NAME"
}) })
def test_introspect_error(self): def test_introspect_error(self):
@ -167,15 +159,14 @@ class TestBaremetalWorkflows(utils.TestCommand):
baremetal.introspect, baremetal.introspect,
self.app.client_manager, self.app.client_manager,
node_uuids=[], node_uuids=[],
run_validations=False, run_validations=False
queue_name="QUEUE_NAME") )
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.introspect', 'tripleo.baremetal.v1.introspect',
workflow_input={ workflow_input={
'node_uuids': [], 'node_uuids': [],
'run_validations': False, 'run_validations': False,
'queue_name': "QUEUE_NAME"
}) })
def test_introspect_manageable_nodes_success(self): def test_introspect_manageable_nodes_success(self):
@ -187,14 +178,12 @@ class TestBaremetalWorkflows(utils.TestCommand):
}]) }])
baremetal.introspect_manageable_nodes( baremetal.introspect_manageable_nodes(
self.app.client_manager, run_validations=False, self.app.client_manager, run_validations=False
queue_name="QUEUE_NAME") )
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.introspect_manageable_nodes', 'tripleo.baremetal.v1.introspect_manageable_nodes',
workflow_input={ workflow_input={
'run_validations': False, 'run_validations': False,
'queue_name': "QUEUE_NAME"
}) })
def test_introspect_manageable_nodes_error(self): def test_introspect_manageable_nodes_error(self):
@ -205,14 +194,13 @@ class TestBaremetalWorkflows(utils.TestCommand):
exceptions.IntrospectionError, exceptions.IntrospectionError,
baremetal.introspect_manageable_nodes, baremetal.introspect_manageable_nodes,
self.app.client_manager, self.app.client_manager,
run_validations=False, run_validations=False
queue_name="QUEUE_NAME") )
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.introspect_manageable_nodes', 'tripleo.baremetal.v1.introspect_manageable_nodes',
workflow_input={ workflow_input={
'run_validations': False, 'run_validations': False,
'queue_name': "QUEUE_NAME"
}) })
def test_introspect_manageable_nodes_mixed_status(self): def test_introspect_manageable_nodes_mixed_status(self):
@ -228,14 +216,13 @@ class TestBaremetalWorkflows(utils.TestCommand):
exceptions.IntrospectionError, exceptions.IntrospectionError,
baremetal.introspect_manageable_nodes, baremetal.introspect_manageable_nodes,
self.app.client_manager, self.app.client_manager,
run_validations=False, run_validations=False
queue_name="QUEUE_NAME") )
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.introspect_manageable_nodes', 'tripleo.baremetal.v1.introspect_manageable_nodes',
workflow_input={ workflow_input={
'run_validations': False, 'run_validations': False,
'queue_name': "QUEUE_NAME"
}) })
def test_provide_manageable_nodes_success(self): 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 self.websocket.wait_for_messages.return_value = self.message_success
baremetal.provide_manageable_nodes( baremetal.provide_manageable_nodes(
self.app.client_manager, queue_name="QUEUE_NAME") self.app.client_manager
)
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.provide_manageable_nodes', 'tripleo.baremetal.v1.provide_manageable_nodes',
workflow_input={'queue_name': "QUEUE_NAME"}) workflow_input={}
)
def test_provide_manageable_nodes_error(self): def test_provide_manageable_nodes_error(self):
@ -256,24 +245,23 @@ class TestBaremetalWorkflows(utils.TestCommand):
self.assertRaises( self.assertRaises(
exceptions.NodeProvideError, exceptions.NodeProvideError,
baremetal.provide_manageable_nodes, baremetal.provide_manageable_nodes,
self.app.client_manager, queue_name="QUEUE_NAME") self.app.client_manager)
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.provide_manageable_nodes', 'tripleo.baremetal.v1.provide_manageable_nodes',
workflow_input={'queue_name': "QUEUE_NAME"}) workflow_input={}
)
def test_configure_success(self): def test_configure_success(self):
self.websocket.wait_for_messages.return_value = self.message_success self.websocket.wait_for_messages.return_value = self.message_success
baremetal.configure(self.app.client_manager, node_uuids=[], baremetal.configure(self.app.client_manager, node_uuids=[])
queue_name="QUEUE_NAME")
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.configure', 'tripleo.baremetal.v1.configure',
workflow_input={ workflow_input={
'node_uuids': [], 'node_uuids': [],
'queue_name': "QUEUE_NAME"
}) })
def test_configure_error(self): def test_configure_error(self):
@ -284,28 +272,25 @@ class TestBaremetalWorkflows(utils.TestCommand):
exceptions.NodeConfigurationError, exceptions.NodeConfigurationError,
baremetal.configure, baremetal.configure,
self.app.client_manager, self.app.client_manager,
node_uuids=[], node_uuids=[]
queue_name="QUEUE_NAME") )
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.configure', 'tripleo.baremetal.v1.configure',
workflow_input={ workflow_input={
'node_uuids': [], 'node_uuids': [],
'queue_name': "QUEUE_NAME"
}) })
def test_configure_manageable_nodes_success(self): def test_configure_manageable_nodes_success(self):
self.websocket.wait_for_messages.return_value = self.message_success self.websocket.wait_for_messages.return_value = self.message_success
baremetal.configure_manageable_nodes(self.app.client_manager, baremetal.configure_manageable_nodes(self.app.client_manager)
queue_name="QUEUE_NAME")
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.configure_manageable_nodes', 'tripleo.baremetal.v1.configure_manageable_nodes',
workflow_input={ workflow_input={}
'queue_name': "QUEUE_NAME" )
})
def test_configure_manageable_nodes_error(self): def test_configure_manageable_nodes_error(self):
@ -314,11 +299,10 @@ class TestBaremetalWorkflows(utils.TestCommand):
self.assertRaises( self.assertRaises(
exceptions.NodeConfigurationError, exceptions.NodeConfigurationError,
baremetal.configure_manageable_nodes, baremetal.configure_manageable_nodes,
self.app.client_manager, self.app.client_manager
queue_name="QUEUE_NAME") )
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal.v1.configure_manageable_nodes', 'tripleo.baremetal.v1.configure_manageable_nodes',
workflow_input={ workflow_input={}
'queue_name': "QUEUE_NAME" )
})

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
import mock import mock
import uuid
from osc_lib.tests import utils from osc_lib.tests import utils
@ -44,10 +43,6 @@ class TestParameterWorkflows(utils.TestCommand):
self.tripleoclient.messaging_websocket.return_value = self.websocket self.tripleoclient.messaging_websocket.return_value = self.websocket
self.app.client_manager.tripleoclient = self.tripleoclient 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): def test_get_overcloud_passwords(self):
self.websocket.wait_for_messages.return_value = iter([{ self.websocket.wait_for_messages.return_value = iter([{
"execution": {"id": "IDID"}, "execution": {"id": "IDID"},
@ -57,13 +52,12 @@ class TestParameterWorkflows(utils.TestCommand):
parameters.get_overcloud_passwords( parameters.get_overcloud_passwords(
self.app.client_manager, self.app.client_manager,
container='container-name', container='container-name'
queue_name=str(uuid.uuid4())) )
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.get_passwords', 'tripleo.plan_management.v1.get_passwords',
workflow_input={'queue_name': 'UUID4', workflow_input={'container': 'container-name'})
'container': 'container-name'})
@mock.patch('yaml.safe_load') @mock.patch('yaml.safe_load')
@mock.patch("six.moves.builtins.open") @mock.patch("six.moves.builtins.open")
@ -95,7 +89,6 @@ class TestParameterWorkflows(utils.TestCommand):
'tripleo.derive_params.v1.derive_parameters', 'tripleo.derive_params.v1.derive_parameters',
workflow_input={ workflow_input={
'plan': 'overcloud', 'plan': 'overcloud',
'queue_name': 'UUID4',
'user_inputs': { 'user_inputs': {
'num_phy_cores_per_numa_node_for_pmd': 2}}) 'num_phy_cores_per_numa_node_for_pmd': 2}})
@ -129,7 +122,6 @@ class TestParameterWorkflows(utils.TestCommand):
'tripleo.derive_params.v1.derive_parameters', 'tripleo.derive_params.v1.derive_parameters',
workflow_input={ workflow_input={
'plan': 'overcloud', 'plan': 'overcloud',
'queue_name': 'UUID4',
'user_inputs': { 'user_inputs': {
'num_phy_cores_per_numa_node_for_pmd': 2}}) '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( self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.get_deprecated_parameters', 'tripleo.plan_management.v1.get_deprecated_parameters',
workflow_input={'queue_name': 'UUID4', workflow_input={'container': 'container-name'})
'container': 'container-name'})
@mock.patch("sys.stdout", new_callable=TestStringCapture) @mock.patch("sys.stdout", new_callable=TestStringCapture)
def test_check_deprecated_params_user_defined(self, mock_print): 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( self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.get_deprecated_parameters', 'tripleo.plan_management.v1.get_deprecated_parameters',
workflow_input={'queue_name': 'UUID4', workflow_input={'container': 'container-name'})
'container': 'container-name'})
std_output = mock_print.getvalue() std_output = mock_print.getvalue()
self.assertIn('TestParameter1', std_output) self.assertIn('TestParameter1', std_output)
@ -215,8 +205,7 @@ class TestParameterWorkflows(utils.TestCommand):
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.get_deprecated_parameters', 'tripleo.plan_management.v1.get_deprecated_parameters',
workflow_input={'queue_name': 'UUID4', workflow_input={'container': 'container-name'})
'container': 'container-name'})
std_output = mock_print.getvalue() std_output = mock_print.getvalue()
self.assertNotIn('TestParameter1', std_output) self.assertNotIn('TestParameter1', std_output)

View File

@ -39,10 +39,6 @@ class TestPlanCreationWorkflows(utils.TestCommand):
"status": "SUCCESS", "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', @mock.patch('tripleoclient.workflows.plan_management.tarball',
autospec=True) autospec=True)
def test_create_plan_from_templates_success(self, mock_tarball): 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( self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={'queue_name': 'UUID4', workflow_input={'container': 'test-overcloud',
'container': 'test-overcloud',
'generate_passwords': True}) 'generate_passwords': True})
@mock.patch('tripleoclient.workflows.plan_management.tarball', @mock.patch('tripleoclient.workflows.plan_management.tarball',
@ -108,8 +103,7 @@ class TestPlanCreationWorkflows(utils.TestCommand):
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={'queue_name': 'UUID4', workflow_input={'container': 'test-overcloud',
'container': 'test-overcloud',
'generate_passwords': True}) 'generate_passwords': True})
mock_open_context.assert_has_calls( mock_open_context.assert_has_calls(
@ -140,8 +134,7 @@ class TestPlanCreationWorkflows(utils.TestCommand):
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={'queue_name': 'UUID4', workflow_input={'container': 'test-overcloud',
'container': 'test-overcloud',
'generate_passwords': True}) 'generate_passwords': True})
mock_open_context.assert_has_calls( mock_open_context.assert_has_calls(
@ -172,8 +165,7 @@ class TestPlanCreationWorkflows(utils.TestCommand):
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={'queue_name': 'UUID4', workflow_input={'container': 'test-overcloud',
'container': 'test-overcloud',
'generate_passwords': True}) 'generate_passwords': True})
mock_open_context.assert_has_calls( mock_open_context.assert_has_calls(
@ -215,8 +207,7 @@ class TestPlanCreationWorkflows(utils.TestCommand):
self.workflow.executions.create.assert_called_once_with( self.workflow.executions.create.assert_called_once_with(
'tripleo.plan_management.v1.create_deployment_plan', 'tripleo.plan_management.v1.create_deployment_plan',
workflow_input={'queue_name': 'UUID4', workflow_input={'container': 'test-overcloud',
'container': 'test-overcloud',
'generate_passwords': False}) 'generate_passwords': False})

View File

@ -33,10 +33,6 @@ class TestSupportFetchLogs(fakes.TestDeployOvercloud):
self.tripleoclient.messaging_websocket.return_value = self.websocket self.tripleoclient.messaging_websocket.return_value = self.websocket
self.app.client_manager.tripleoclient = self.tripleoclient 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.wait_for_messages')
@mock.patch('tripleoclient.workflows.base.start_workflow') @mock.patch('tripleoclient.workflows.base.start_workflow')
def test_fetch_logs(self, start_wf_mock, messages_mock): 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_name = 'tripleo.support.v1.fetch_logs'
fetch_input = { fetch_input = {
'server_name': 'test', 'server_name': 'test',
'container': 'test', 'container': 'test'
'queue_name': 'UUID4'
} }
support.fetch_logs(self.app.client_manager, 'test', 'test') support.fetch_logs(self.app.client_manager, 'test', 'test')
start_wf_mock.assert_called_once_with(self.workflow, start_wf_mock.assert_called_once_with(self.workflow,
@ -60,8 +55,7 @@ class TestSupportFetchLogs(fakes.TestDeployOvercloud):
fetch_input = { fetch_input = {
'server_name': 'test', 'server_name': 'test',
'container': 'test', 'container': 'test',
'queue_name': 'UUID4', 'timeout': 59
'timeout': 59,
} }
support.fetch_logs(self.app.client_manager, 'test', 'test', timeout=59) support.fetch_logs(self.app.client_manager, 'test', 'test', timeout=59)
start_wf_mock.assert_called_once_with(self.workflow, start_wf_mock.assert_called_once_with(self.workflow,
@ -76,8 +70,7 @@ class TestSupportFetchLogs(fakes.TestDeployOvercloud):
fetch_input = { fetch_input = {
'server_name': 'test', 'server_name': 'test',
'container': 'test', 'container': 'test',
'queue_name': 'UUID4', 'concurrency': 10
'concurrency': 10,
} }
support.fetch_logs(self.app.client_manager, 'test', 'test', support.fetch_logs(self.app.client_manager, 'test', 'test',
concurrency=10) concurrency=10)
@ -99,18 +92,13 @@ class TestSupportDeleteContainer(fakes.TestDeployOvercloud):
self.tripleoclient.messaging_websocket.return_value = self.websocket self.tripleoclient.messaging_websocket.return_value = self.websocket
self.app.client_manager.tripleoclient = self.tripleoclient 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.wait_for_messages')
@mock.patch('tripleoclient.workflows.base.start_workflow') @mock.patch('tripleoclient.workflows.base.start_workflow')
def test_delete_container(self, start_wf_mock, messages_mock): def test_delete_container(self, start_wf_mock, messages_mock):
messages_mock.return_value = [] messages_mock.return_value = []
fetch_name = 'tripleo.support.v1.delete_container' fetch_name = 'tripleo.support.v1.delete_container'
fetch_input = { fetch_input = {
'container': 'test', 'container': 'test'
'queue_name': 'UUID4'
} }
support.delete_container(self.app.client_manager, 'test') support.delete_container(self.app.client_manager, 'test')
start_wf_mock.assert_called_once_with(self.workflow, 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_name = 'tripleo.support.v1.delete_container'
fetch_input = { fetch_input = {
'container': 'test', 'container': 'test',
'queue_name': 'UUID4', 'timeout': 59
'timeout': 59,
} }
support.delete_container(self.app.client_manager, 'test', timeout=59) support.delete_container(self.app.client_manager, 'test', timeout=59)
start_wf_mock.assert_called_once_with(self.workflow, 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_name = 'tripleo.support.v1.delete_container'
fetch_input = { fetch_input = {
'container': 'test', 'container': 'test',
'queue_name': 'UUID4', 'concurrency': 10
'concurrency': 10,
} }
support.delete_container(self.app.client_manager, 'test', support.delete_container(self.app.client_manager, 'test',
concurrency=10) concurrency=10)

View File

@ -19,7 +19,6 @@ import argparse
import logging import logging
import simplejson import simplejson
import time import time
import uuid
import ironic_inspector_client import ironic_inspector_client
from osc_lib.command import command 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 " _("OS_BAREMETAL_API_VERSION must be >=1.11 for use of "
"'enroll' provision state; currently %s") % api_version) "'enroll' provision state; currently %s") % api_version)
queue_name = str(uuid.uuid4())
if parsed_args.no_deploy_image: if parsed_args.no_deploy_image:
deploy_kernel = None deploy_kernel = None
deploy_ramdisk = None deploy_ramdisk = None
@ -190,7 +187,6 @@ class ImportBaremetal(command.Command):
baremetal.register_or_update( baremetal.register_or_update(
self.app.client_manager, self.app.client_manager,
nodes_json=nodes_config, nodes_json=nodes_config,
queue_name=queue_name,
kernel_name=deploy_kernel, kernel_name=deploy_kernel,
ramdisk_name=deploy_ramdisk, ramdisk_name=deploy_ramdisk,
instance_boot_option=parsed_args.instance_boot_option, instance_boot_option=parsed_args.instance_boot_option,
@ -224,7 +220,6 @@ class StartBaremetalIntrospectionBulk(command.Command):
'overcloud node introspect" to introspect manageable ' 'overcloud node introspect" to introspect manageable '
'nodes instead.') 'nodes instead.')
queue_name = str(uuid.uuid4())
clients = self.app.client_manager clients = self.app.client_manager
client = self.app.client_manager.baremetal client = self.app.client_manager.baremetal
@ -242,13 +237,12 @@ class StartBaremetalIntrospectionBulk(command.Command):
print("Starting introspection of manageable nodes") print("Starting introspection of manageable nodes")
baremetal.introspect_manageable_nodes( baremetal.introspect_manageable_nodes(
clients, clients,
run_validations=parsed_args.run_validations, run_validations=parsed_args.run_validations
queue_name=queue_name) )
print("Setting manageable nodes to available...") print("Setting manageable nodes to available...")
self.log.debug("Moving manageable nodes to available state.") 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): class StatusBaremetalIntrospectionBulk(command.Lister):
@ -417,7 +411,6 @@ class ConfigureBaremetalBoot(command.Command):
'overcloud node configure" to configure manageable ' 'overcloud node configure" to configure manageable '
'nodes instead.') 'nodes instead.')
queue_name = str(uuid.uuid4())
bm_client = self.app.client_manager.baremetal bm_client = self.app.client_manager.baremetal
for node in bm_client.node.list(maintenance=False): for node in bm_client.node.list(maintenance=False):
@ -445,7 +438,6 @@ class ConfigureBaremetalBoot(command.Command):
baremetal.configure( baremetal.configure(
self.app.client_manager, self.app.client_manager,
node_uuids=[node.uuid], node_uuids=[node.uuid],
queue_name=queue_name,
kernel_name=parsed_args.deploy_kernel, kernel_name=parsed_args.deploy_kernel,
ramdisk_name=parsed_args.deploy_ramdisk, ramdisk_name=parsed_args.deploy_ramdisk,
root_device=parsed_args.root_device, root_device=parsed_args.root_device,

View File

@ -22,7 +22,6 @@ import re
import shutil import shutil
import six import six
import tempfile import tempfile
import uuid
import yaml import yaml
from heatclient.common import template_utils from heatclient.common import template_utils
@ -519,8 +518,8 @@ class DeployOvercloud(command.Command):
if self._password_cache is None: if self._password_cache is None:
self._password_cache = workflow_params.get_overcloud_passwords( self._password_cache = workflow_params.get_overcloud_passwords(
self.clients, self.clients,
container=stack_name, container=stack_name
queue_name=str(uuid.uuid4())) )
return self._password_cache[password_name] return self._password_cache[password_name]
@ -688,7 +687,6 @@ class DeployOvercloud(command.Command):
'parameters': parameters, 'parameters': parameters,
'default_role_counts': self._get_default_role_counts(parsed_args), 'default_role_counts': self._get_default_role_counts(parsed_args),
'run_validations': True, 'run_validations': True,
'queue_name': str(uuid.uuid4()),
} }
errors, warnings = validations.check_predeployment_validations( errors, warnings = validations.check_predeployment_validations(

View File

@ -17,7 +17,6 @@ import argparse
import logging import logging
import os.path import os.path
import re import re
import uuid
from osc_lib.command import command from osc_lib.command import command
@ -44,8 +43,7 @@ class RemoteExecute(command.Command):
config = parsed_args.file_in.read() config = parsed_args.file_in.read()
workflow_client = self.app.client_manager.workflow_engine workflow_client = self.app.client_manager.workflow_engine
tripleoclients = self.app.client_manager.tripleoclient tripleoclients = self.app.client_manager.tripleoclient
queue_name = str(uuid.uuid4()) messaging_websocket = tripleoclients.messaging_websocket()
messaging_websocket = tripleoclients.messaging_websocket(queue_name)
# no special characters here # no special characters here
config_name = re.sub('[^\w]*', '', config_name = re.sub('[^\w]*', '',
@ -58,8 +56,7 @@ class RemoteExecute(command.Command):
'server_name': parsed_args.server_name, 'server_name': parsed_args.server_name,
'config_name': config_name, 'config_name': config_name,
'group': parsed_args.group, 'group': parsed_args.group,
'config': config, 'config': config
'queue_name': queue_name
} }
workflow_client.executions.create( workflow_client.executions.create(

View File

@ -15,7 +15,6 @@
import argparse import argparse
import logging import logging
import uuid
from osc_lib.command import command from osc_lib.command import command
from osc_lib.i18n import _ from osc_lib.i18n import _
@ -104,15 +103,11 @@ class ProvideNode(command.Command):
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args) self.log.debug("take_action(%s)" % parsed_args)
queue_name = str(uuid.uuid4())
if parsed_args.node_uuids: if parsed_args.node_uuids:
baremetal.provide(self.app.client_manager, baremetal.provide(self.app.client_manager,
node_uuids=parsed_args.node_uuids, node_uuids=parsed_args.node_uuids)
queue_name=queue_name)
else: else:
baremetal.provide_manageable_nodes(self.app.client_manager, baremetal.provide_manageable_nodes(self.app.client_manager)
queue_name=queue_name)
class IntrospectNode(command.Command): class IntrospectNode(command.Command):
@ -147,28 +142,26 @@ class IntrospectNode(command.Command):
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args) self.log.debug("take_action(%s)" % parsed_args)
queue_name = str(uuid.uuid4())
nodes = parsed_args.node_uuids nodes = parsed_args.node_uuids
if nodes: if nodes:
baremetal.introspect(self.app.client_manager, baremetal.introspect(self.app.client_manager,
node_uuids=nodes, node_uuids=nodes,
run_validations=parsed_args.run_validations, run_validations=parsed_args.run_validations
queue_name=queue_name) )
else: else:
baremetal.introspect_manageable_nodes( baremetal.introspect_manageable_nodes(
self.app.client_manager, self.app.client_manager,
run_validations=parsed_args.run_validations, run_validations=parsed_args.run_validations
queue_name=queue_name) )
if parsed_args.provide: if parsed_args.provide:
if nodes: if nodes:
baremetal.provide(self.app.client_manager, baremetal.provide(self.app.client_manager,
node_uuids=nodes, node_uuids=nodes,
queue_name=queue_name) )
else: else:
baremetal.provide_manageable_nodes(self.app.client_manager, baremetal.provide_manageable_nodes(self.app.client_manager)
queue_name=queue_name)
class ImportNode(command.Command): class ImportNode(command.Command):
@ -208,8 +201,6 @@ class ImportNode(command.Command):
nodes_config = oooutils.parse_env_file(parsed_args.env_file) nodes_config = oooutils.parse_env_file(parsed_args.env_file)
queue_name = str(uuid.uuid4())
if parsed_args.no_deploy_image: if parsed_args.no_deploy_image:
deploy_kernel = None deploy_kernel = None
deploy_ramdisk = None deploy_ramdisk = None
@ -220,7 +211,6 @@ class ImportNode(command.Command):
nodes = baremetal.register_or_update( nodes = baremetal.register_or_update(
self.app.client_manager, self.app.client_manager,
nodes_json=nodes_config, nodes_json=nodes_config,
queue_name=queue_name,
kernel_name=deploy_kernel, kernel_name=deploy_kernel,
ramdisk_name=deploy_ramdisk, ramdisk_name=deploy_ramdisk,
instance_boot_option=parsed_args.instance_boot_option instance_boot_option=parsed_args.instance_boot_option
@ -231,13 +221,13 @@ class ImportNode(command.Command):
if parsed_args.introspect: if parsed_args.introspect:
baremetal.introspect(self.app.client_manager, baremetal.introspect(self.app.client_manager,
node_uuids=nodes_uuids, node_uuids=nodes_uuids,
run_validations=parsed_args.run_validations, run_validations=parsed_args.run_validations
queue_name=queue_name) )
if parsed_args.provide: if parsed_args.provide:
baremetal.provide(self.app.client_manager, baremetal.provide(self.app.client_manager,
node_uuids=nodes_uuids, node_uuids=nodes_uuids,
queue_name=queue_name) )
class ConfigureNode(command.Command): class ConfigureNode(command.Command):
@ -289,13 +279,10 @@ class ConfigureNode(command.Command):
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args) self.log.debug("take_action(%s)" % parsed_args)
queue_name = str(uuid.uuid4())
if parsed_args.node_uuids: if parsed_args.node_uuids:
baremetal.configure( baremetal.configure(
self.app.client_manager, self.app.client_manager,
node_uuids=parsed_args.node_uuids, node_uuids=parsed_args.node_uuids,
queue_name=queue_name,
kernel_name=parsed_args.deploy_kernel, kernel_name=parsed_args.deploy_kernel,
ramdisk_name=parsed_args.deploy_ramdisk, ramdisk_name=parsed_args.deploy_ramdisk,
instance_boot_option=parsed_args.instance_boot_option, instance_boot_option=parsed_args.instance_boot_option,
@ -307,7 +294,6 @@ class ConfigureNode(command.Command):
else: else:
baremetal.configure_manageable_nodes( baremetal.configure_manageable_nodes(
self.app.client_manager, self.app.client_manager,
queue_name=queue_name,
kernel_name=parsed_args.deploy_kernel, kernel_name=parsed_args.deploy_kernel,
ramdisk_name=parsed_args.deploy_ramdisk, ramdisk_name=parsed_args.deploy_ramdisk,
instance_boot_option=parsed_args.instance_boot_option, instance_boot_option=parsed_args.instance_boot_option,
@ -358,8 +344,6 @@ class DiscoverNode(command.Command):
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args) self.log.debug("take_action(%s)" % parsed_args)
queue_name = str(uuid.uuid4())
if parsed_args.no_deploy_image: if parsed_args.no_deploy_image:
deploy_kernel = None deploy_kernel = None
deploy_ramdisk = None deploy_ramdisk = None
@ -377,7 +361,6 @@ class DiscoverNode(command.Command):
self.app.client_manager, self.app.client_manager,
ip_addresses=parsed_args.ip_addresses, ip_addresses=parsed_args.ip_addresses,
credentials=credentials, credentials=credentials,
queue_name=queue_name,
kernel_name=deploy_kernel, kernel_name=deploy_kernel,
ramdisk_name=deploy_ramdisk, ramdisk_name=deploy_ramdisk,
instance_boot_option=parsed_args.instance_boot_option, instance_boot_option=parsed_args.instance_boot_option,
@ -389,10 +372,9 @@ class DiscoverNode(command.Command):
if parsed_args.introspect: if parsed_args.introspect:
baremetal.introspect(self.app.client_manager, baremetal.introspect(self.app.client_manager,
node_uuids=nodes_uuids, node_uuids=nodes_uuids,
run_validations=parsed_args.run_validations, run_validations=parsed_args.run_validations
queue_name=queue_name) )
if parsed_args.provide: if parsed_args.provide:
baremetal.provide(self.app.client_manager, baremetal.provide(self.app.client_manager,
node_uuids=nodes_uuids, node_uuids=nodes_uuids
queue_name=queue_name) )

View File

@ -13,7 +13,6 @@
import json import json
import logging import logging
import os.path import os.path
import uuid
from osc_lib.command import command from osc_lib.command import command
from osc_lib.i18n import _ from osc_lib.i18n import _
@ -135,8 +134,9 @@ class CreatePlan(command.Command):
plan_env_file=parsed_args.plan_environment_file) plan_env_file=parsed_args.plan_environment_file)
else: else:
plan_management.create_deployment_plan( plan_management.create_deployment_plan(
clients, container=name, queue_name=str(uuid.uuid4()), clients, container=name,
generate_passwords=generate_passwords, source_url=source_url, generate_passwords=generate_passwords,
source_url=source_url,
use_default_templates=use_default_templates) use_default_templates=use_default_templates)
@ -201,7 +201,9 @@ class ExportPlan(command.Command):
print("Exporting plan %s..." % plan) print("Exporting plan %s..." % plan)
tempurl = plan_management.export_deployment_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) f = request.urlopen(tempurl)
tarball_contents = f.read() tarball_contents = f.read()

View File

@ -18,7 +18,6 @@ import os
from osc_lib.command import command from osc_lib.command import command
from osc_lib.i18n import _ from osc_lib.i18n import _
import uuid
import yaml import yaml
from tripleoclient.workflows import baremetal from tripleoclient.workflows import baremetal
@ -71,9 +70,7 @@ class CreateRAID(command.Command):
_('Logical disks list is expected to be a list of objects, ' _('Logical disks list is expected to be a list of objects, '
'got %r instead') % disks) 'got %r instead') % disks)
queue_name = str(uuid.uuid4())
clients = self.app.client_manager clients = self.app.client_manager
baremetal.create_raid_configuration(clients, baremetal.create_raid_configuration(clients,
queue_name=queue_name,
node_uuids=parsed_args.node, node_uuids=parsed_args.node,
configuration=configuration) configuration=configuration)

View File

@ -15,9 +15,9 @@
import logging import logging
import os import os
import uuid
import yaml import yaml
from osc_lib.command import command from osc_lib.command import command
from osc_lib.i18n import _ from osc_lib.i18n import _
from oslo_concurrency import processutils from oslo_concurrency import processutils
@ -106,8 +106,8 @@ class UpdateOvercloud(command.Command):
"to update your current containers deployed.") "to update your current containers deployed.")
# Execute minor update # Execute minor update
package_update.update(clients, container=stack_name, package_update.update(clients, container=stack_name,
container_registry=registry, container_registry=registry
queue_name=str(uuid.uuid4())) )
print("Minor update init on stack {0} complete.".format( print("Minor update init on stack {0} complete.".format(
parsed_args.stack)) parsed_args.stack))
@ -134,6 +134,6 @@ class UpdateOvercloud(command.Command):
output = package_update.update_ansible( output = package_update.update_ansible(
clients, nodes=nodes, clients, nodes=nodes,
inventory_file=inventory, inventory_file=inventory,
playbook=playbook, playbook=playbook
queue_name=str(uuid.uuid4())) )
print(output) print(output)

View File

@ -26,9 +26,8 @@ def register_or_update(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.baremetal.v1.register_or_update', 'tripleo.baremetal.v1.register_or_update',
@ -72,14 +71,12 @@ def provide(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.baremetal.v1.provide', 'tripleo.baremetal.v1.provide',
workflow_input={'node_uuids': workflow_input['node_uuids'], workflow_input={'node_uuids': workflow_input['node_uuids']}
'queue_name': queue_name}
) )
for payload in base.wait_for_messages(workflow_client, ws, execution): 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 workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
queue_name = workflow_input['queue_name']
print("Waiting for introspection to finish...") print("Waiting for introspection to finish...")
with tripleoclients.messaging_websocket(queue_name) as ws: with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.baremetal.v1.introspect', 'tripleo.baremetal.v1.introspect',
workflow_input={ workflow_input={
'node_uuids': workflow_input['node_uuids'], 'node_uuids': workflow_input['node_uuids'],
'run_validations': workflow_input['run_validations'], 'run_validations': workflow_input['run_validations']}
'queue_name': queue_name
}
) )
for payload in base.wait_for_messages(workflow_client, ws, execution): 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 workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
queue_name = workflow_input['queue_name']
print("Waiting for introspection to finish...") print("Waiting for introspection to finish...")
errors = [] errors = []
with tripleoclients.messaging_websocket(queue_name) as ws: with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.baremetal.v1.introspect_manageable_nodes', 'tripleo.baremetal.v1.introspect_manageable_nodes',
workflow_input={ workflow_input={
'run_validations': workflow_input['run_validations'], 'run_validations': workflow_input['run_validations']}
'queue_name': queue_name,
}
) )
for payload in base.wait_for_messages(workflow_client, ws, execution): 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 workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.baremetal.v1.provide_manageable_nodes', '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): 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 workflow_client = clients.workflow_engine
ooo_client = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.baremetal.v1.configure', 'tripleo.baremetal.v1.configure',
@ -235,9 +224,8 @@ def configure_manageable_nodes(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
ooo_client = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.baremetal.v1.configure_manageable_nodes', 'tripleo.baremetal.v1.configure_manageable_nodes',
@ -263,11 +251,10 @@ def create_raid_configuration(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
ooo_client = clients.tripleoclient ooo_client = clients.tripleoclient
queue_name = workflow_input['queue_name']
print('Creating RAID configuration for given nodes, this may take time') 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.baremetal.v1.create_raid_configuration', 'tripleo.baremetal.v1.create_raid_configuration',
@ -293,9 +280,8 @@ def discover_and_enroll(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.baremetal.v1.discover_and_enroll_nodes', 'tripleo.baremetal.v1.discover_and_enroll_nodes',

View File

@ -13,7 +13,6 @@ from __future__ import print_function
import pprint import pprint
import time import time
import uuid
from heatclient.common import event_utils from heatclient.common import event_utils
from openstackclient import shell from openstackclient import shell
@ -28,9 +27,8 @@ def deploy(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.deployment.v1.deploy_plan', 'tripleo.deployment.v1.deploy_plan',
@ -53,8 +51,7 @@ def deploy_and_wait(log, clients, stack, plan_name, verbose_level,
workflow_input = { workflow_input = {
"container": plan_name, "container": plan_name,
"run_validations": run_validations, "run_validations": run_validations,
"skip_deploy_identifier": skip_deploy_identifier, "skip_deploy_identifier": skip_deploy_identifier
"queue_name": str(uuid.uuid4()),
} }
if timeout is not None: if timeout is not None:

View File

@ -14,6 +14,7 @@ from __future__ import print_function
import pprint import pprint
import time import time
from heatclient.common import event_utils from heatclient.common import event_utils
from openstackclient import shell from openstackclient import shell
from tripleoclient import exceptions from tripleoclient import exceptions
@ -25,10 +26,9 @@ from tripleoclient.workflows import base
def update(clients, **workflow_input): def update(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
queue_name = workflow_input['queue_name']
plan_name = workflow_input['container'] plan_name = workflow_input['container']
with tripleoclients.messaging_websocket(queue_name) as ws: with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.package_update.v1.package_update_plan', 'tripleo.package_update.v1.package_update_plan',
@ -57,9 +57,8 @@ def update(clients, **workflow_input):
def update_ansible(clients, **workflow_input): def update_ansible(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.package_update.v1.update_nodes', 'tripleo.package_update.v1.update_nodes',

View File

@ -9,7 +9,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import uuid
import yaml import yaml
from tripleoclient import exceptions from tripleoclient import exceptions
@ -31,9 +30,8 @@ def get_overcloud_passwords(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.plan_management.v1.get_passwords', '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(): for wf_name, wf_inputs in plan_env_data["workflow_parameters"].items():
print('Invoking workflow (%s) specified in plan-environment ' print('Invoking workflow (%s) specified in plan-environment '
'file' % wf_name) 'file' % wf_name)
inputs = {} inputs = {'plan': stack_name, 'user_inputs': wf_inputs}
inputs['plan'] = stack_name
queue_name = str(uuid.uuid4())
inputs['queue_name'] = queue_name
inputs['user_inputs'] = wf_inputs
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
with tripleoclients.messaging_websocket(queue_name) as ws: with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
wf_name, wf_name,
@ -101,13 +95,11 @@ def check_deprecated_parameters(clients, container):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
queue_name = str(uuid.uuid4())
workflow_input = { workflow_input = {
'container': container, 'container': container
'queue_name': queue_name
} }
with tripleoclients.messaging_websocket(queue_name) as ws: with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.plan_management.v1.get_deprecated_parameters', 'tripleo.plan_management.v1.get_deprecated_parameters',

View File

@ -11,7 +11,6 @@
# under the License. # under the License.
import logging import logging
import tempfile import tempfile
import uuid
import yaml import yaml
from swiftclient import exceptions as swift_exc 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): def _create_update_deployment_plan(clients, workflow, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow, workflow_client, workflow,
workflow_input=workflow_input workflow_input=workflow_input
@ -144,7 +142,6 @@ def create_plan_from_templates(clients, name, tht_root, roles_file=None,
try: try:
create_deployment_plan(clients, container=name, create_deployment_plan(clients, container=name,
queue_name=str(uuid.uuid4()),
generate_passwords=generate_passwords) generate_passwords=generate_passwords)
except exceptions.WorkflowServiceError: except exceptions.WorkflowServiceError:
swiftutils.delete_container(swift_client, name) swiftutils.delete_container(swift_client, name)
@ -188,7 +185,6 @@ def update_plan_from_templates(clients, name, tht_root, roles_file=None,
networks_file) networks_file)
_update_passwords(swift_client, name, passwords) _update_passwords(swift_client, name, passwords)
update_deployment_plan(clients, container=name, update_deployment_plan(clients, container=name,
queue_name=str(uuid.uuid4()),
generate_passwords=generate_passwords, generate_passwords=generate_passwords,
source_url=None) source_url=None)
@ -215,7 +211,6 @@ def _update_passwords(swift_client, name, passwords):
def export_deployment_plan(clients, **workflow_input): def export_deployment_plan(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
queue_name = workflow_input['queue_name']
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
@ -223,7 +218,7 @@ def export_deployment_plan(clients, **workflow_input):
workflow_input=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, for payload in base.wait_for_messages(workflow_client, ws, execution,
_WORKFLOW_TIMEOUT): _WORKFLOW_TIMEOUT):
if 'message' in payload: if 'message' in payload:

View File

@ -14,8 +14,6 @@
# under the License. # under the License.
from __future__ import print_function from __future__ import print_function
import uuid
from tripleoclient.exceptions import InvalidConfiguration from tripleoclient.exceptions import InvalidConfiguration
from tripleoclient.workflows import base from tripleoclient.workflows import base
@ -24,9 +22,8 @@ def delete_node(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient 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( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.scale.v1.delete_node', 'tripleo.scale.v1.delete_node',
@ -51,7 +48,6 @@ def scale_down(clients, plan_name, nodes, timeout=None):
workflow_input = { workflow_input = {
"container": plan_name, "container": plan_name,
"nodes": nodes, "nodes": nodes,
"queue_name": str(uuid.uuid4()),
} }
if timeout is not None: if timeout is not None:

View File

@ -14,8 +14,6 @@
# under the License. # under the License.
from __future__ import print_function from __future__ import print_function
import uuid
from tripleoclient.exceptions import InvalidConfiguration from tripleoclient.exceptions import InvalidConfiguration
from tripleoclient.workflows import base from tripleoclient.workflows import base
@ -31,13 +29,10 @@ def delete_stack(clients, stack):
tripleoclient = clients.tripleoclient tripleoclient = clients.tripleoclient
workflow_input = { workflow_input = {
'stack': stack, 'stack': stack
'queue_name': str(uuid.uuid4()),
} }
queue_name = workflow_input['queue_name'] with tripleoclient.messaging_websocket() as ws:
with tripleoclient.messaging_websocket(queue_name) as ws:
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
'tripleo.stack.v1.delete_stack', 'tripleo.stack.v1.delete_stack',

View File

@ -14,7 +14,6 @@
# #
import os import os
import uuid
from osc_lib.i18n import _ from osc_lib.i18n import _
@ -74,7 +73,6 @@ def fetch_logs(clients, container, server_name, timeout=None,
workflow_input = { workflow_input = {
"container": container, "container": container,
"server_name": server_name, "server_name": server_name,
"queue_name": str(uuid.uuid4()),
} }
if timeout is not None: if timeout is not None:
@ -84,7 +82,6 @@ def fetch_logs(clients, container, server_name, timeout=None,
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
queue_name = workflow_input['queue_name']
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
@ -92,7 +89,7 @@ def fetch_logs(clients, container, server_name, timeout=None,
workflow_input=workflow_input workflow_input=workflow_input
) )
websocket = tripleoclients.messaging_websocket(queue_name) websocket = tripleoclients.messaging_websocket()
messages = base.wait_for_messages(workflow_client, messages = base.wait_for_messages(workflow_client,
websocket, websocket,
execution, execution,
@ -115,7 +112,6 @@ def delete_container(clients, container, timeout=None, concurrency=None):
""" """
workflow_input = { workflow_input = {
"container": container, "container": container,
"queue_name": str(uuid.uuid4()),
} }
if timeout is not None: if timeout is not None:
@ -125,7 +121,6 @@ def delete_container(clients, container, timeout=None, concurrency=None):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
queue_name = workflow_input['queue_name']
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
@ -133,7 +128,7 @@ def delete_container(clients, container, timeout=None, concurrency=None):
workflow_input=workflow_input workflow_input=workflow_input
) )
websocket = tripleoclients.messaging_websocket(queue_name) websocket = tripleoclients.messaging_websocket()
messages = base.wait_for_messages(workflow_client, messages = base.wait_for_messages(workflow_client,
websocket, websocket,
execution, execution,

View File

@ -15,7 +15,6 @@ from tripleoclient.workflows import base
def check_predeployment_validations(clients, **workflow_input): def check_predeployment_validations(clients, **workflow_input):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
queue_name = workflow_input['queue_name']
execution = base.start_workflow( execution = base.start_workflow(
workflow_client, workflow_client,
@ -25,7 +24,7 @@ def check_predeployment_validations(clients, **workflow_input):
errors = [] errors = []
warnings = [] 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): for payload in base.wait_for_messages(workflow_client, ws, execution):
if payload.get('message'): if payload.get('message'):
print(payload['message']) print(payload['message'])