1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Added parameter to select Content-Type when accessing the Rundeck API (#7684)

* Added parameter to select Content-Type when accessing the Rundeck API

* Removed autogenerated file

* Fixed missing yml extension

* Updated changelog text better describe what has happened

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Nils Brinkmann <nils.brinkmann@rheinmetall.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Nils Brinkmann 2024-05-12 09:21:39 +02:00 committed by GitHub
parent 7aa118b957
commit 4f4075a542
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

4
.gitignore vendored
View file

@ -512,3 +512,7 @@ $RECYCLE.BIN/
# Integration tests cloud configs
tests/integration/cloud-config-*.ini
# VSCode specific extensions
.vscode/settings.json

View file

@ -0,0 +1,2 @@
minor_changes:
- rundeck module utils - allow to pass ``Content-Type`` to API requests (https://github.com/ansible-collections/community.general/pull/7684).

View file

@ -28,7 +28,7 @@ def api_argument_spec():
return api_argument_spec
def api_request(module, endpoint, data=None, method="GET"):
def api_request(module, endpoint, data=None, method="GET", content_type="application/json"):
"""Manages Rundeck API requests via HTTP(S)
:arg module: The AnsibleModule (used to get url, api_version, api_token, etc).
@ -63,7 +63,7 @@ def api_request(module, endpoint, data=None, method="GET"):
data=json.dumps(data),
method=method,
headers={
"Content-Type": "application/json",
"Content-Type": content_type,
"Accept": "application/json",
"X-Rundeck-Auth-Token": module.params["api_token"]
}