Fix force parameter being always added to URL in execution delete

Co-Authored-By: Dougal Matthews <dougal@redhat.com>
Closes-Bug: 1775027
Change-Id: Ia3984a7879ed93292e39b03af65253fb8c4f67e8
This commit is contained in:
Pierre Gaxatte 2018-06-04 17:28:57 +02:00 committed by Dougal Matthews
parent b62fe64b2a
commit 146d1c17e2
4 changed files with 15 additions and 4 deletions

View File

@ -117,7 +117,8 @@ class ExecutionManager(base.ResourceManager):
self._ensure_not_empty(id=id)
qparams = {}
qparams['force'] = bool(force)
if force:
qparams['force'] = True
query_string = ("?%s" % urlparse.urlencode(list(qparams.items()))
if qparams else "")

View File

@ -245,7 +245,7 @@ class MistralClientTestBase(base.MistralCLIAuth, base.MistralCLIAltAuth):
self.mistral_cli,
admin,
'execution-delete',
params=exec_id
params="{} --force".format(exec_id)
)
return ex

View File

@ -660,7 +660,8 @@ class ExecutionCLITests(base_v2.MistralClientTestBase):
self.assertIn(wf_name, [ex['Workflow name'] for ex in execs])
self.assertIn(namespace, [ex['Workflow namespace'] for ex in execs])
self.mistral_admin('execution-delete', params=exec_id)
params = "{} --force".format(exec_id)
self.mistral_admin('execution-delete', params=params)
def test_execution_create_delete(self):
@ -688,7 +689,8 @@ class ExecutionCLITests(base_v2.MistralClientTestBase):
self.assertIn(exec_id, [ex['ID'] for ex in execs])
self.assertIn(wf_name, [ex['Workflow name'] for ex in execs])
self.mistral_admin('execution-delete', params=exec_id)
params = "{} --force".format(exec_id)
self.mistral_admin('execution-delete', params=params)
def test_execution_create_with_input_and_start_task(self):
execution = self.execution_create(

View File

@ -0,0 +1,8 @@
---
fixes:
- |
mistralclient 3.5.0 introduced a new --force option to delete executions
that are still running. However, this had the unintended impact of passing
force=false when it wasn't provided. This is incompatible with previous
releases of the Mistral API which reject requests as they don't recognise
"force".