|
|
|
@ -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:
|
|
|
|
|