From e73d3dfe20380a0bdfe213496654c1a8207c7ab7 Mon Sep 17 00:00:00 2001 From: Evgeny Fedoruk Date: Wed, 6 Dec 2017 16:18:45 +0200 Subject: [PATCH] Fixing bug when returned 404 status code considered as invalid (#33530) In case of workflow delete action, the returned 404 status code considered as invalid although it's a valid code for not found (deleted) entity. Removed verification of the status. Only success should be verified. Fixes #33524 --- lib/ansible/modules/network/radware/vdirect_runnable.py | 2 +- test/units/modules/network/radware/test_vdirect_runnable.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/radware/vdirect_runnable.py b/lib/ansible/modules/network/radware/vdirect_runnable.py index 10bec6fae7..77488715df 100644 --- a/lib/ansible/modules/network/radware/vdirect_runnable.py +++ b/lib/ansible/modules/network/radware/vdirect_runnable.py @@ -294,7 +294,7 @@ class VdirectRunnable(object): result = self.client.runnable.run(data, self.type, self.name, self.action_name) result_to_return = {'msg': ''} if result[rest_client.RESP_STATUS] == 200: - if result[rest_client.RESP_DATA]['status'] == 200 and result[rest_client.RESP_DATA]['success']: + if result[rest_client.RESP_DATA]['success']: if self.type == WORKFLOW_TEMPLATE_RUNNABLE_TYPE: result_to_return['msg'] = WORKFLOW_CREATION_SUCCESS elif self.type == CONFIGURATION_TEMPLATE_RUNNABLE_TYPE: diff --git a/test/units/modules/network/radware/test_vdirect_runnable.py b/test/units/modules/network/radware/test_vdirect_runnable.py index 4a391bff9f..ff389f8114 100644 --- a/test/units/modules/network/radware/test_vdirect_runnable.py +++ b/test/units/modules/network/radware/test_vdirect_runnable.py @@ -261,6 +261,10 @@ class TestManager(unittest.TestCase): res = vdirectRunnable.run() assert res == MODULE_RESULT + RUN_RESULT[self.module_mock.rest_client.RESP_DATA]['status'] = 404 + vdirectRunnable.run() + assert res == MODULE_RESULT + RUN_RESULT[self.module_mock.rest_client.RESP_STATUS] = 400 RUN_RESULT[self.module_mock.rest_client.RESP_REASON] = "Reason" RUN_RESULT[self.module_mock.rest_client.RESP_STR] = "Details"