summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorchkp-orso <47325598+chkp-orso@users.noreply.github.com>2019-08-29 15:30:51 +0200
committerSumit Jaiswal <sjaiswal@redhat.com>2019-08-29 15:30:51 +0200
commita321e58c73b0cbbc45f94933b96a070e17963587 (patch)
tree8ddc3581925c59767a6a09ec41d82a5e8fc32f64 /lib
parentDefer passlib dependency from plugins/filter/network.py (#59304) (diff)
downloadansible-a321e58c73b0cbbc45f94933b96a070e17963587.tar.xz
ansible-a321e58c73b0cbbc45f94933b96a070e17963587.zip
fix suboptions of list to replacce _ with - (#61542)
* fix suboptions of list to replacce _ with - * Update checkpoint.py
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/module_utils/network/checkpoint/checkpoint.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/network/checkpoint/checkpoint.py b/lib/ansible/module_utils/network/checkpoint/checkpoint.py
index 336481e7c4..4582c4e586 100644
--- a/lib/ansible/module_utils/network/checkpoint/checkpoint.py
+++ b/lib/ansible/module_utils/network/checkpoint/checkpoint.py
@@ -74,6 +74,11 @@ def get_payload_from_parameters(params):
if parameter_value and is_checkpoint_param(parameter):
if isinstance(parameter_value, dict):
payload[parameter.replace("_", "-")] = get_payload_from_parameters(parameter_value)
+ elif isinstance(parameter_value, list) and len(parameter_value) != 0 and isinstance(parameter_value[0], dict):
+ payload_list = []
+ for element_dict in parameter_value:
+ payload_list.append(get_payload_from_parameters(element_dict))
+ payload[parameter.replace("_", "-")] = payload_list
else:
payload[parameter.replace("_", "-")] = parameter_value
return payload
@@ -190,9 +195,12 @@ def api_call(module, api_call_object):
payload_for_equals = {'type': api_call_object, 'params': payload}
equals_code, equals_response = send_request(connection, version, 'equals', payload_for_equals)
+
# 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: