diff --git a/mistralclient/api/v2/executions.py b/mistralclient/api/v2/executions.py index e95c3789..7db0aec6 100644 --- a/mistralclient/api/v2/executions.py +++ b/mistralclient/api/v2/executions.py @@ -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 "") diff --git a/mistralclient/tests/functional/cli/v2/base_v2.py b/mistralclient/tests/functional/cli/v2/base_v2.py index 4f0d69ca..f76679c3 100644 --- a/mistralclient/tests/functional/cli/v2/base_v2.py +++ b/mistralclient/tests/functional/cli/v2/base_v2.py @@ -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 diff --git a/mistralclient/tests/functional/cli/v2/cli_tests_v2.py b/mistralclient/tests/functional/cli/v2/cli_tests_v2.py index 2b7c8cca..befe02cc 100644 --- a/mistralclient/tests/functional/cli/v2/cli_tests_v2.py +++ b/mistralclient/tests/functional/cli/v2/cli_tests_v2.py @@ -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( diff --git a/releasenotes/notes/fix-regression-with-execution-force-delete-af8d1968cb2673ef.yaml b/releasenotes/notes/fix-regression-with-execution-force-delete-af8d1968cb2673ef.yaml new file mode 100644 index 00000000..4dca33b5 --- /dev/null +++ b/releasenotes/notes/fix-regression-with-execution-force-delete-af8d1968cb2673ef.yaml @@ -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".