mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Added timeout to jenkins_script POST request (#24924)
* Added timeout to jenkins_script POST request The timeout value is passed to fetch_url to allow a custom timeout bigger than the predefined 10 seconds. * Added version, removed no_log
This commit is contained in:
parent
cd13b70903
commit
d2032116cd
1 changed files with 9 additions and 1 deletions
|
@ -65,6 +65,12 @@ options:
|
||||||
- The password to connect to the jenkins server with.
|
- The password to connect to the jenkins server with.
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: null
|
||||||
|
timeout:
|
||||||
|
description:
|
||||||
|
- The request timeout in seconds
|
||||||
|
required: false
|
||||||
|
default: 10
|
||||||
|
version_added: "2.4"
|
||||||
args:
|
args:
|
||||||
description:
|
description:
|
||||||
- A dict of key-value pairs used in formatting the script.
|
- A dict of key-value pairs used in formatting the script.
|
||||||
|
@ -154,6 +160,7 @@ def main():
|
||||||
validate_certs=dict(required=False, type="bool", default=True),
|
validate_certs=dict(required=False, type="bool", default=True),
|
||||||
user=dict(required=False, no_log=True, type="str", default=None),
|
user=dict(required=False, no_log=True, type="str", default=None),
|
||||||
password=dict(required=False, no_log=True, type="str", default=None),
|
password=dict(required=False, no_log=True, type="str", default=None),
|
||||||
|
timeout=dict(required=False, type="int", default=10),
|
||||||
args=dict(required=False, type="dict", default=None)
|
args=dict(required=False, type="dict", default=None)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -180,7 +187,8 @@ def main():
|
||||||
module.params['url'] + "/scriptText",
|
module.params['url'] + "/scriptText",
|
||||||
data=urlencode({'script': script_contents}),
|
data=urlencode({'script': script_contents}),
|
||||||
headers=headers,
|
headers=headers,
|
||||||
method="POST")
|
method="POST",
|
||||||
|
timeout=module.params['timeout'])
|
||||||
|
|
||||||
if info["status"] != 200:
|
if info["status"] != 200:
|
||||||
module.fail_json(msg="HTTP error " + str(info["status"]) + " " + info["msg"])
|
module.fail_json(msg="HTTP error " + str(info["status"]) + " " + info["msg"])
|
||||||
|
|
Loading…
Reference in a new issue