mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-09-19 05:28:09 -07:00
[PR #10829/7c40c6b6 backport][stable-10] Keycloak role fix changed status (#10838)
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.15) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.15) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
Keycloak role fix changed status (#10829)
* Exclude aliases before comparison
* add test
* fragment
* Update changelogs/fragments/10829-fix-keycloak-role-changed-status.yml
---------
(cherry picked from commit 7c40c6b6b5
)
Co-authored-by: desand01 <desrosiers.a@hotmail.com>
Co-authored-by: Andre Desrosiers <andre.desrosiers@ssss.gouv.qc.ca>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
f8acda70d2
commit
7a8c3346ff
5 changed files with 45 additions and 2 deletions
|
@ -13,7 +13,7 @@ Source Ansible env-setup from ansible github repository
|
|||
|
||||
Run integration tests:
|
||||
|
||||
ansible-test integration keycloak_role --python 3.10 --allow-unsupported
|
||||
ansible-test integration -v keycloak_role --allow-unsupported --docker fedora35 --docker-network host
|
||||
|
||||
Cleanup:
|
||||
|
||||
|
|
|
@ -3,6 +3,15 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Delete realm if exists
|
||||
community.general.keycloak_realm:
|
||||
auth_keycloak_url: "{{ url }}"
|
||||
auth_realm: "{{ admin_realm }}"
|
||||
auth_username: "{{ admin_user }}"
|
||||
auth_password: "{{ admin_password }}"
|
||||
realm: "{{ realm }}"
|
||||
state: absent
|
||||
|
||||
- name: Create realm
|
||||
community.general.keycloak_realm:
|
||||
auth_keycloak_url: "{{ url }}"
|
||||
|
@ -297,6 +306,29 @@
|
|||
- result is not changed
|
||||
- result.end_state.composites | length == 3
|
||||
|
||||
- name: Change realm role with composites using aliases no change
|
||||
community.general.keycloak_role:
|
||||
auth_keycloak_url: "{{ url }}"
|
||||
auth_realm: "{{ admin_realm }}"
|
||||
auth_username: "{{ admin_user }}"
|
||||
auth_password: "{{ admin_password }}"
|
||||
name: "{{ keycloak_role_name }}"
|
||||
realm: "{{ realm }}"
|
||||
description: "{{ keycloak_role_description }}"
|
||||
composite: "{{ keycloak_role_composite }}"
|
||||
composites: "{{ keycloak_role_composites_with_aliases }}"
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- name: Debug
|
||||
debug:
|
||||
var: result
|
||||
|
||||
- name: Assert realm role with composites using aliases have not changed
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Remove composite from realm role with composites
|
||||
community.general.keycloak_role:
|
||||
auth_keycloak_url: "{{ url }}"
|
||||
|
|
|
@ -25,6 +25,15 @@ keycloak_role_composites:
|
|||
state: present
|
||||
- name: offline_access
|
||||
state: present
|
||||
keycloak_role_composites_with_aliases:
|
||||
- name: view-clients
|
||||
clientId: "realm-management"
|
||||
state: present
|
||||
- name: query-clients
|
||||
clientId: "realm-management"
|
||||
state: present
|
||||
- name: offline_access
|
||||
state: present
|
||||
keycloak_client_id: test-client
|
||||
keycloak_client_name: test-client
|
||||
keycloak_client_description: This is a client for testing purpose
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue