mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
[PR #6300/a35542d0 backport][stable-6] Rundeck modules fixes and improvements (#6343)
Rundeck modules fixes and improvements (#6300)
* feat: add token alias to api_token parameter
* fix: return (None, info) on empty content response
* feat: update the modules for using module_utils.rundeck funcs
* docs: add changelog fragment
* fix: add trailing commas
* fix: changelog fragment invalid syntax
* fix: changelog typos
* fix: remove token aliases from api_token
* fix: add token alias to api_token param
* fix: add partial overwrite of params and docs
(cherry picked from commit a35542d0d1
)
Co-authored-by: Phillipe Smith <phsmithcc@gmail.com>
This commit is contained in:
parent
590ff351b4
commit
aa8728b22c
4 changed files with 106 additions and 134 deletions
|
@ -81,12 +81,18 @@ def api_request(module, endpoint, data=None, method="GET"):
|
|||
|
||||
try:
|
||||
content = response.read()
|
||||
json_response = json.loads(content)
|
||||
return json_response, info
|
||||
|
||||
if not content:
|
||||
return None, info
|
||||
else:
|
||||
json_response = json.loads(content)
|
||||
return json_response, info
|
||||
except AttributeError as error:
|
||||
module.fail_json(msg="Rundeck API request error",
|
||||
exception=to_native(error),
|
||||
execution_info=info)
|
||||
module.fail_json(
|
||||
msg="Rundeck API request error",
|
||||
exception=to_native(error),
|
||||
execution_info=info
|
||||
)
|
||||
except ValueError as error:
|
||||
module.fail_json(
|
||||
msg="No valid JSON response",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue