PR to support Ansible Checkmode in Checkpoint modules (#57695)

* added checkmode support

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
pull/59254/head
Sumit Jaiswal 5 years ago committed by GitHub
parent b01b1d40cf
commit b2d8ef69f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -169,6 +169,7 @@ def api_call(module, api_call_object):
result = {'changed': False}
if module.params['state'] == 'present':
if not module.check_mode:
if equals_code == 200:
if not equals_response['equals']:
code, response = send_request(connection, version, 'set-' + api_call_object, payload)
@ -191,8 +192,8 @@ def api_call(module, api_call_object):
result['changed'] = True
result[api_call_object] = response
else:
# state == absent
elif module.params['state'] == 'absent':
if not module.check_mode:
if equals_code == 200:
code, response = send_request(connection, version, 'delete-' + api_call_object, payload)
if code != 200:

@ -196,7 +196,9 @@ def main():
argument_spec.update(checkpoint_argument_spec_for_objects)
module = AnsibleModule(argument_spec=argument_spec, required_one_of=[['name', 'uid']],
mutually_exclusive=[['name', 'uid']])
mutually_exclusive=[['name', 'uid']],
supports_check_mode=True)
api_call_object = 'network'
result = api_call(module, api_call_object)

Loading…
Cancel
Save