Add timeout to jenkins_script csrf requests (#62850)

This commit is contained in:
Jesus Alvarez 2019-11-15 02:49:01 -08:00 committed by John R Barker
parent 864a597a3e
commit 069c7959da

View file

@ -114,6 +114,7 @@ from ansible.module_utils._text import to_native
def is_csrf_protection_enabled(module): def is_csrf_protection_enabled(module):
resp, info = fetch_url(module, resp, info = fetch_url(module,
module.params['url'] + '/api/json', module.params['url'] + '/api/json',
timeout=module.params['timeout'],
method='GET') method='GET')
if info["status"] != 200: if info["status"] != 200:
module.fail_json(msg="HTTP error " + str(info["status"]) + " " + info["msg"], output='') module.fail_json(msg="HTTP error " + str(info["status"]) + " " + info["msg"], output='')
@ -126,6 +127,7 @@ def get_crumb(module, cookies):
resp, info = fetch_url(module, resp, info = fetch_url(module,
module.params['url'] + '/crumbIssuer/api/json', module.params['url'] + '/crumbIssuer/api/json',
method='GET', method='GET',
timeout=module.params['timeout'],
cookies=cookies) cookies=cookies)
if info["status"] != 200: if info["status"] != 200:
module.fail_json(msg="HTTP error " + str(info["status"]) + " " + info["msg"], output='') module.fail_json(msg="HTTP error " + str(info["status"]) + " " + info["msg"], output='')