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
changes/02/509902/11
Toure Dunnon 5 years ago
parent 79cbcddd7e
commit 1bd1620ead
  1. 6
      tripleoclient/plugin.py
  2. 2
      tripleoclient/tests/fakes.py
  3. 2
      tripleoclient/tests/v1/baremetal/fakes.py
  4. 19
      tripleoclient/tests/v1/baremetal/test_baremetal.py
  5. 2
      tripleoclient/tests/v1/overcloud_deploy/fakes.py
  6. 6
      tripleoclient/tests/v1/overcloud_node/fakes.py
  7. 51
      tripleoclient/tests/v1/overcloud_node/test_overcloud_node.py
  8. 2
      tripleoclient/tests/v1/overcloud_update/fakes.py
  9. 7
      tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py
  10. 26
      tripleoclient/tests/v1/test_overcloud_plan.py
  11. 2
      tripleoclient/tests/v1/test_overcloud_raid.py
  12. 78
      tripleoclient/tests/workflows/test_baremetal.py
  13. 23
      tripleoclient/tests/workflows/test_parameters.py
  14. 19
      tripleoclient/tests/workflows/test_plan_management.py
  15. 26
      tripleoclient/tests/workflows/test_support.py
  16. 14
      tripleoclient/v1/baremetal.py
  17. 6
      tripleoclient/v1/overcloud_deploy.py
  18. 7
      tripleoclient/v1/overcloud_execute.py
  19. 48
      tripleoclient/v1/overcloud_node.py
  20. 10
      tripleoclient/v1/overcloud_plan.py
  21. 3
      tripleoclient/v1/overcloud_raid.py
  22. 10
      tripleoclient/v1/overcloud_update.py
  23. 40
      tripleoclient/workflows/baremetal.py
  24. 7
      tripleoclient/workflows/deployment.py
  25. 7
      tripleoclient/workflows/package_update.py
  26. 18
      tripleoclient/workflows/parameters.py
  27. 9
      tripleoclient/workflows/plan_management.py
  28. 6
      tripleoclient/workflows/scale.py
  29. 9
      tripleoclient/workflows/stack_management.py
  30. 9
      tripleoclient/workflows/support.py
  31. 3
      tripleoclient/workflows/validations.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):

@ -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

@ -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

@ -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,

@ -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()

@ -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)

@ -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)

@ -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()

@ -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()))
)

@ -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')

@ -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,
}
)

@ -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={}
)

@ -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)

@ -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})

@ -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)

@ -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,

@ -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(

@ -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(

@ -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())