Remove mistral from the create_container deploy workflow
This change removes all of mistral from the create_container function by calling the required functions directly. Story: 2007212 Task: 38780 Change-Id: Icdcd4589f413fb510ee56d6a27c110e3cc065ddf Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
parent
b49610cea2
commit
aefda7f205
@ -126,6 +126,14 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
horizon_url.return_value = 'fake://url:12345'
|
||||
self.addCleanup(horizon_url.stop)
|
||||
|
||||
self.create_action = mock.patch(
|
||||
'tripleo_common.actions.plan.CreateContainerAction.run',
|
||||
autospec=True,
|
||||
return_value=None
|
||||
)
|
||||
self.create_action.start()
|
||||
self.addCleanup(self.create_action.stop)
|
||||
|
||||
def tearDown(self):
|
||||
super(TestDeployOvercloud, self).tearDown()
|
||||
os.unlink(self.parameter_defaults_env_file)
|
||||
|
@ -141,6 +141,14 @@ class TestOvercloudCreatePlan(utils.TestCommand):
|
||||
self.workflow.executions.create.return_value = execution
|
||||
self.swift = self.app.client_manager.tripleoclient.object_store
|
||||
|
||||
self.create_action = mock.patch(
|
||||
'tripleo_common.actions.plan.CreateContainerAction.run',
|
||||
autospec=True,
|
||||
return_value=None
|
||||
)
|
||||
self.create_action.start()
|
||||
self.addCleanup(self.create_action.stop)
|
||||
|
||||
def test_create_default_plan(self):
|
||||
|
||||
# Setup
|
||||
@ -219,12 +227,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
|
||||
# Run
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
# Verify
|
||||
self.workflow.action_executions.create.assert_called_once_with(
|
||||
'tripleo.plan.create_container', {"container": "overcast"},
|
||||
run_sync=True, save_result=True
|
||||
)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.plan_management.v1.create_deployment_plan',
|
||||
workflow_input={
|
||||
@ -277,12 +279,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
|
||||
self.assertRaises(exceptions.WorkflowServiceError,
|
||||
self.cmd.take_action, parsed_args)
|
||||
|
||||
# Verify
|
||||
self.workflow.action_executions.create.assert_called_once_with(
|
||||
'tripleo.plan.create_container', {"container": "overcast"},
|
||||
run_sync=True, save_result=True
|
||||
)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.plan_management.v1.create_deployment_plan',
|
||||
workflow_input={
|
||||
@ -323,12 +319,6 @@ class TestOvercloudCreatePlan(utils.TestCommand):
|
||||
with mock.patch('six.moves.builtins.open', mock_open_context):
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
# Verify
|
||||
self.workflow.action_executions.create.assert_called_once_with(
|
||||
'tripleo.plan.create_container', {"container": "overcast"},
|
||||
run_sync=True, save_result=True
|
||||
)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.plan_management.v1.create_deployment_plan',
|
||||
workflow_input={
|
||||
|
@ -39,6 +39,14 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||
"status": "SUCCESS",
|
||||
}])
|
||||
|
||||
self.create_action = mock.patch(
|
||||
'tripleo_common.actions.plan.CreateContainerAction.run',
|
||||
autospec=True,
|
||||
return_value=None
|
||||
)
|
||||
self.create_action.start()
|
||||
self.addCleanup(self.create_action.stop)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.plan_management.tarball',
|
||||
autospec=True)
|
||||
def test_create_plan_from_templates_success(self, mock_tarball):
|
||||
@ -54,20 +62,19 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||
'/tht-root/',
|
||||
validate_stack=False)
|
||||
|
||||
self.workflow.action_executions.create.assert_called_once_with(
|
||||
'tripleo.plan.create_container',
|
||||
{'container': 'test-overcloud'},
|
||||
run_sync=True, save_result=True)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.plan_management.v1.create_deployment_plan',
|
||||
workflow_input={'container': 'test-overcloud',
|
||||
'generate_passwords': True,
|
||||
'validate_stack': False})
|
||||
|
||||
@mock.patch('tripleoclient.workflows.plan_management.create_container',
|
||||
autospec=True,
|
||||
return_value=mock.Mock(error='Error'))
|
||||
@mock.patch('tripleoclient.workflows.plan_management.tarball',
|
||||
autospec=True)
|
||||
def test_create_plan_from_templates_container_error(self, mock_tarball):
|
||||
def test_create_plan_from_templates_container_error(self, mock_tarball,
|
||||
mock_create_container):
|
||||
error = mock.Mock(output='{"result": "Error"}')
|
||||
error.id = "IDID"
|
||||
self.workflow.action_executions.create.return_value = error
|
||||
@ -81,11 +88,6 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||
'/tht-root/',
|
||||
validate_stack=False)
|
||||
|
||||
self.workflow.action_executions.create.assert_called_once_with(
|
||||
'tripleo.plan.create_container',
|
||||
{'container': 'test-overcloud'},
|
||||
run_sync=True, save_result=True)
|
||||
|
||||
self.workflow.executions.create.assert_not_called()
|
||||
|
||||
@mock.patch('tripleoclient.utils.rel_or_abs_path')
|
||||
@ -108,11 +110,6 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||
'the_roles_file.yaml',
|
||||
validate_stack=False)
|
||||
|
||||
self.workflow.action_executions.create.assert_called_once_with(
|
||||
'tripleo.plan.create_container',
|
||||
{'container': 'test-overcloud'},
|
||||
run_sync=True, save_result=True)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.plan_management.v1.create_deployment_plan',
|
||||
workflow_input={'container': 'test-overcloud',
|
||||
@ -143,11 +140,6 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||
plan_env_file='the-plan-environment.yaml',
|
||||
validate_stack=False)
|
||||
|
||||
self.workflow.action_executions.create.assert_called_once_with(
|
||||
'tripleo.plan.create_container',
|
||||
{'container': 'test-overcloud'},
|
||||
run_sync=True, save_result=True)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.plan_management.v1.create_deployment_plan',
|
||||
workflow_input={'container': 'test-overcloud',
|
||||
@ -178,11 +170,6 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||
networks_file='the-network-data.yaml',
|
||||
validate_stack=False)
|
||||
|
||||
self.workflow.action_executions.create.assert_called_once_with(
|
||||
'tripleo.plan.create_container',
|
||||
{'container': 'test-overcloud'},
|
||||
run_sync=True, save_result=True)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.plan_management.v1.create_deployment_plan',
|
||||
workflow_input={'container': 'test-overcloud',
|
||||
@ -226,11 +213,6 @@ class TestPlanCreationWorkflows(utils.TestCommand):
|
||||
generate_passwords=False,
|
||||
validate_stack=False)
|
||||
|
||||
self.workflow.action_executions.create.assert_called_once_with(
|
||||
'tripleo.plan.create_container',
|
||||
{'container': 'test-overcloud'},
|
||||
run_sync=True, save_result=True)
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.plan_management.v1.create_deployment_plan',
|
||||
workflow_input={'container': 'test-overcloud',
|
||||
|
@ -128,9 +128,22 @@ def list_deployment_plans(clients):
|
||||
return plan.ListPlansAction().run(mistral_context)
|
||||
|
||||
|
||||
def create_container(workflow_client, **input_):
|
||||
return base.call_action(workflow_client, 'tripleo.plan.create_container',
|
||||
**input_)
|
||||
def create_container(clients, container):
|
||||
"""Create a container.
|
||||
|
||||
:param clients: openstack clients
|
||||
:type clients: Object
|
||||
|
||||
:param container: Name of the container to create
|
||||
:type container: String
|
||||
|
||||
:returns: Object
|
||||
"""
|
||||
|
||||
mistral_context = clients.tripleoclient.create_mistral_context()
|
||||
return plan.CreateContainerAction(
|
||||
container=container
|
||||
).run(context=mistral_context)
|
||||
|
||||
|
||||
def create_plan_from_templates(clients, name, tht_root, roles_file=None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user