Skip to content

rundeck_acl_policy: fix project acls are put/posted to the wrong endpoint #10097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 17, 2025

Conversation

kjoyce77
Copy link
Contributor

@kjoyce77 kjoyce77 commented May 3, 2025

SUMMARY

The original author of this module did not include logic for when the project is specified for the acl despite adding the option to the doc. This change adds logic that will post/put the acl to the project path if the project is specified.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

rundeck_acl_policy

ADDITIONAL INFORMATION

The second of these steps fail.

- name: Create a system ACL
  community.general.rundeck_acl_policy:
    name: test_acl
    api_version: "{{ rundeck_api_version }}"
    url: "{{ rundeck_url }}"
    token: "{{ rundeck_api_token.stdout_lines[-1] }}"
    state: present
    policy: "{{ system_acl_policy }}"

- name: Create a project ACL
  community.general.rundeck_acl_policy:
    name: test_acl
    api_version: "{{ rundeck_api_version }}"
    url: "{{ rundeck_url }}"
    token: "{{ rundeck_api_token.stdout_lines[-1] }}"
    state: present
    policy: "{{ project_acl_policy }}"
    project: test_project

When running the playbook the second step fails, not because of the absence of test_project, but because the acl is seen as invalid since the module is posting to the system endpoint.

# before
(general) nimbus@odin:~/dev/ansible_collections/community/general$ ansible-test integration unsupported/rundeck --docker
PLAY [testhost] ****************************************************************

TASK [Gathering Facts] *********************************************************
ok: [testhost]

TASK [rundeck : Generate a Rundeck API Token] **********************************
FAILED - RETRYING: [testhost]: Generate a Rundeck API Token (3 retries left).
changed: [testhost]

TASK [rundeck : Create a Rundeck project] **************************************
changed: [testhost]

TASK [rundeck : Create a system ACL] *******************************************
changed: [testhost]

TASK [rundeck : Create a project ACL] ******************************************
fatal: [testhost]: FAILED! => {"changed": false, "msg": "Unable to validate acl test_acl. Please ensure it is a valid ACL"}

# after
(general) nimbus@odin:~/dev/ansible_collections/community/general$ ansible-test integration unsupported/rundeck --docker
TASK [rundeck : Create a Rundeck project] **************************************
changed: [testhost]

TASK [rundeck : Create a system ACL] *******************************************
changed: [testhost]

TASK [rundeck : Create a project ACL] ******************************************
changed: [testhost]

TASK [rundeck : Retrieve ACLs] *************************************************
ok: [testhost] => (item=system/acl/test_acl.aclpolicy)
ok: [testhost] => (item=project/test_project/acl/test_acl.aclpolicy)

TASK [rundeck : Assert ACL content is correct] *********************************
ok: [testhost] => {
    "changed": false,
    "msg": "All assertions passed"

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added WIP Work in progress bug This issue/PR relates to a bug integration tests/integration module module new_contributor Help guide this first time contributor new_plugin New plugin plugins plugin (any type) tests tests unit tests/unit labels May 3, 2025
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added the needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI label May 3, 2025
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot removed the needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI label May 3, 2025
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added the ci_verified Push fixes to PR branch to re-run CI label May 4, 2025
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-9 Automatically create a backport for the stable-9 branch backport-10 Automatically create a backport for the stable-10 branch labels May 4, 2025
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I've added a first comment.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI and removed ci_verified Push fixes to PR branch to re-run CI labels May 5, 2025
@ansibullbot ansibullbot removed the ci_verified Push fixes to PR branch to re-run CI label May 7, 2025
@kjoyce77 kjoyce77 marked this pull request as ready for review May 8, 2025 02:43
@ansibullbot ansibullbot removed the WIP Work in progress label May 8, 2025
@felixfontein
Copy link
Collaborator

If nobody objects, I'll merge this in a few days.

@russoz russoz changed the title Fix project acls are put/posted to the wrong endpoint rundeck_acl_policy: fix project acls are put/posted to the wrong endpoint May 17, 2025
@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label May 17, 2025
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label May 17, 2025
@felixfontein felixfontein merged commit ff0ed6f into ansible-collections:main May 17, 2025
135 checks passed
Copy link

patchback bot commented May 17, 2025

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/ff0ed6f91205403f21cd50fe86fdbae0f34221e8/pr-10097

Backported as #10150

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request May 17, 2025
…oint (#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

Co-authored-by: Felix Fontein <[email protected]>

* Fix pep8 formatting

* Add licensing to unit test

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit ff0ed6f)
Copy link

patchback bot commented May 17, 2025

Backport to stable-10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-10/ff0ed6f91205403f21cd50fe86fdbae0f34221e8/pr-10097

Backported as #10151

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein
Copy link
Collaborator

@kjoyce77 thanks for your contribution!
@russoz thanks for reviewing!

patchback bot pushed a commit that referenced this pull request May 17, 2025
…oint (#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

Co-authored-by: Felix Fontein <[email protected]>

* Fix pep8 formatting

* Add licensing to unit test

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit ff0ed6f)
felixfontein added a commit that referenced this pull request May 17, 2025
…ct acls are put/posted to the wrong endpoint (#10150)

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 ff0ed6f)

Co-authored-by: kjoyce77 <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
felixfontein added a commit that referenced this pull request May 17, 2025
…ect 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 ff0ed6f)

Co-authored-by: kjoyce77 <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
russoz pushed a commit to russoz-ansible/community.general that referenced this pull request May 18, 2025
…oint (ansible-collections#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

Co-authored-by: Felix Fontein <[email protected]>

* Fix pep8 formatting

* Add licensing to unit test

---------

Co-authored-by: Felix Fontein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-9 Automatically create a backport for the stable-9 branch backport-10 Automatically create a backport for the stable-10 branch bug This issue/PR relates to a bug integration tests/integration module module new_contributor Help guide this first time contributor new_plugin New plugin plugins plugin (any type) stale_ci CI is older than 7 days, rerun before merging tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants