From 45f573d2ed9d615e422e0f7caa21864367f59a6a Mon Sep 17 00:00:00 2001 From: Sumit Jaiswal Date: Thu, 19 Sep 2019 00:07:36 +0530 Subject: [PATCH] PR to fix if equals error code command is not found (#62539) * fix if equals error code if command not found (#62529) (cherry picked from commit 55f285a384e5b787e93927bce568363bd91e47d8) * changelog --- .../fragments/62529-fix-if-equals-command-not-found.yaml | 3 +++ lib/ansible/module_utils/network/checkpoint/checkpoint.py | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/62529-fix-if-equals-command-not-found.yaml diff --git a/changelogs/fragments/62529-fix-if-equals-command-not-found.yaml b/changelogs/fragments/62529-fix-if-equals-command-not-found.yaml new file mode 100644 index 00000000000..37aca80e574 --- /dev/null +++ b/changelogs/fragments/62529-fix-if-equals-command-not-found.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- "fix if equals error code command is not found(https://github.com/ansible/ansible/pull/62529)" diff --git a/lib/ansible/module_utils/network/checkpoint/checkpoint.py b/lib/ansible/module_utils/network/checkpoint/checkpoint.py index 2d5419c8e03..6bd7306ff1b 100644 --- a/lib/ansible/module_utils/network/checkpoint/checkpoint.py +++ b/lib/ansible/module_utils/network/checkpoint/checkpoint.py @@ -364,6 +364,8 @@ def api_call_for_rule(module, api_call_object): # if code is 400 (bad request) or 500 (internal error) - fail if equals_code == 400 or equals_code == 500: module.fail_json(msg=equals_response) + if equals_code == 404 and equals_response['code'] == 'generic_err_command_not_found': + module.fail_json(msg='Relevant hotfix is not installed on Check Point server. See sk114661 on Check Point Support Center.') if module.params['state'] == 'present': if equals_code == 200: