Fix plan delete

As part of the overcloud delete implementation, we refactored the plan
delete to be a shared function. Unforunately the wrong inputs were being
passed to the workflow so it would return an Invalid input error. This
change fixes the input so that the container is properly passed to the
workflow as an input.

Change-Id: I33032c9e6f4a8cf002e65ebab60752c44fb5fdb2
Closes-Bug: #1647747
This commit is contained in:
Alex Schultz
2016-12-07 13:42:39 -07:00
parent 784e6373e7
commit 1082fdb518
5 changed files with 9 additions and 10 deletions

View File

@@ -63,4 +63,4 @@ class TestDeleteOvercloud(fakes.TestDeployOvercloud):
delete_deployment_plan_mock.assert_called_once_with(
self.workflow,
input={'container': 'overcloud'})
container='overcloud')

View File

@@ -69,7 +69,7 @@ class TestOvercloudDeletePlan(utils.TestCommand):
delete_deployment_plan_mock.assert_called_once_with(
self.workflow,
input={'container': 'test-plan'})
container='test-plan')
@mock.patch(
'tripleoclient.workflows.plan_management.delete_deployment_plan',
@@ -82,8 +82,8 @@ class TestOvercloudDeletePlan(utils.TestCommand):
self.cmd.take_action(parsed_args)
expected = [
mock.call(self.workflow, input={'container': 'test-plan1'}),
mock.call(self.workflow, input={'container': 'test-plan2'}),
mock.call(self.workflow, container='test-plan1'),
mock.call(self.workflow, container='test-plan2'),
]
self.assertEqual(delete_deployment_plan_mock.call_args_list,
expected)

View File

@@ -119,9 +119,9 @@ class TestPlanCreationWorkflows(utils.TestCommand):
plan_management.delete_deployment_plan(
self.workflow,
input={'container': 'overcloud'})
container='overcloud')
self.workflow.action_executions.create.assert_called_once_with(
'tripleo.plan.delete',
{'input': {'container': 'overcloud'}},
{'container': 'overcloud'},
run_sync=True, save_result=True)

View File

@@ -70,7 +70,7 @@ class DeleteOvercloud(command.Command):
try:
plan_management.delete_deployment_plan(
workflow_client,
input={'container': stack_name})
container=stack_name)
except Exception as err:
raise oscexc.CommandError(
"Error occurred while deleting plan {}".format(err))
@@ -83,7 +83,7 @@ class DeleteOvercloud(command.Command):
if not parsed_args.yes:
confirm = utils.prompt_user_for_confirmation(
message=_("Are you sure you want to delete this overcloud "
"[y/N]?"),
"[y/N]? "),
logger=self.log)
if not confirm:
raise oscexc.CommandError("Action not confirmed, exiting.")

View File

@@ -68,10 +68,9 @@ class DeletePlan(command.Command):
for plan in parsed_args.plans:
print("Deleting plan %s..." % plan)
workflow_input = {'container': plan}
try:
plan_management.delete_deployment_plan(workflow_client,
input=workflow_input)
container=plan)
except Exception:
self.log.exception("Error deleting plan")