mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
[PR #10097/ff0ed6f9 backport][stable-10] rundeck_acl_policy: fix project acls are put/posted to the wrong endpoint (#10151)
rundeck_acl_policy: fix project acls are put/posted to the wrong endpoint (#10097)
* Fix project acls are put/posted to the wrong endpoint
* Add changelog fragment.
* Fix 2.7 sanity errors in github
* Fix fragment extension and use 2.7 syntax in test
* Update changelogs/fragments/10097-fix-rundeck_acl_policy-project-endpoint.yml
* Fix pep8 formatting
* Add licensing to unit test
---------
(cherry picked from commit ff0ed6f912
)
Co-authored-by: kjoyce77 <kevin.joyce@outlook.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
f238b90fcf
commit
1f90168f37
7 changed files with 277 additions and 7 deletions
|
@ -129,11 +129,18 @@ from ansible_collections.community.general.plugins.module_utils.rundeck import (
|
|||
class RundeckACLManager:
|
||||
def __init__(self, module):
|
||||
self.module = module
|
||||
if module.params.get("project"):
|
||||
self.endpoint = "project/%s/acl/%s.aclpolicy" % (
|
||||
self.module.params["project"],
|
||||
self.module.params["name"],
|
||||
)
|
||||
else:
|
||||
self.endpoint = "system/acl/%s.aclpolicy" % self.module.params["name"]
|
||||
|
||||
def get_acl(self):
|
||||
resp, info = api_request(
|
||||
module=self.module,
|
||||
endpoint="system/acl/%s.aclpolicy" % self.module.params["name"],
|
||||
endpoint=self.endpoint,
|
||||
)
|
||||
|
||||
return resp
|
||||
|
@ -147,7 +154,7 @@ class RundeckACLManager:
|
|||
|
||||
resp, info = api_request(
|
||||
module=self.module,
|
||||
endpoint="system/acl/%s.aclpolicy" % self.module.params["name"],
|
||||
endpoint=self.endpoint,
|
||||
method="POST",
|
||||
data={"contents": self.module.params["policy"]},
|
||||
)
|
||||
|
@ -171,7 +178,7 @@ class RundeckACLManager:
|
|||
|
||||
resp, info = api_request(
|
||||
module=self.module,
|
||||
endpoint="system/acl/%s.aclpolicy" % self.module.params["name"],
|
||||
endpoint=self.endpoint,
|
||||
method="PUT",
|
||||
data={"contents": self.module.params["policy"]},
|
||||
)
|
||||
|
@ -194,7 +201,7 @@ class RundeckACLManager:
|
|||
if not self.module.check_mode:
|
||||
api_request(
|
||||
module=self.module,
|
||||
endpoint="system/acl/%s.aclpolicy" % self.module.params["name"],
|
||||
endpoint=self.endpoint,
|
||||
method="DELETE",
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue