|
|
@ -106,7 +106,7 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
status_code:
|
|
|
|
status_code:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- A valid, numeric, HTTP status code that signifies success of the request.
|
|
|
|
- A valid, numeric, HTTP status code that signifies success of the request. Can also be comma separated list of status codes.
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: 200
|
|
|
|
default: 200
|
|
|
|
timeout:
|
|
|
|
timeout:
|
|
|
@ -335,7 +335,7 @@ def main():
|
|
|
|
follow_redirects = dict(required=False, default='safe', choices=['all', 'safe', 'none', 'yes', 'no']),
|
|
|
|
follow_redirects = dict(required=False, default='safe', choices=['all', 'safe', 'none', 'yes', 'no']),
|
|
|
|
creates = dict(required=False, default=None),
|
|
|
|
creates = dict(required=False, default=None),
|
|
|
|
removes = dict(required=False, default=None),
|
|
|
|
removes = dict(required=False, default=None),
|
|
|
|
status_code = dict(required=False, default=200, type='int'),
|
|
|
|
status_code = dict(required=False, default=[200], type='list'),
|
|
|
|
timeout = dict(required=False, default=30, type='int'),
|
|
|
|
timeout = dict(required=False, default=30, type='int'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
check_invalid_arguments=False,
|
|
|
|
check_invalid_arguments=False,
|
|
|
@ -358,7 +358,7 @@ def main():
|
|
|
|
redirects = module.params['follow_redirects']
|
|
|
|
redirects = module.params['follow_redirects']
|
|
|
|
creates = module.params['creates']
|
|
|
|
creates = module.params['creates']
|
|
|
|
removes = module.params['removes']
|
|
|
|
removes = module.params['removes']
|
|
|
|
status_code = int(module.params['status_code'])
|
|
|
|
status_code = [int(x) for x in list(module.params['status_code'])]
|
|
|
|
socket_timeout = module.params['timeout']
|
|
|
|
socket_timeout = module.params['timeout']
|
|
|
|
|
|
|
|
|
|
|
|
# Grab all the http headers. Need this hack since passing multi-values is currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}')
|
|
|
|
# Grab all the http headers. Need this hack since passing multi-values is currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}')
|
|
|
@ -427,7 +427,7 @@ def main():
|
|
|
|
uresp['json'] = js
|
|
|
|
uresp['json'] = js
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
if resp['status'] != status_code:
|
|
|
|
if resp['status'] not in status_code:
|
|
|
|
module.fail_json(msg="Status code was not " + str(status_code), content=content, **uresp)
|
|
|
|
module.fail_json(msg="Status code was not " + str(status_code), content=content, **uresp)
|
|
|
|
elif return_content:
|
|
|
|
elif return_content:
|
|
|
|
module.exit_json(changed=changed, content=content, **uresp)
|
|
|
|
module.exit_json(changed=changed, content=content, **uresp)
|
|
|
|