Skip to content
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

keycloak_realm: list of dicts should be list of strings #4241

Closed
1 task done
devium opened this issue Feb 21, 2022 · 4 comments · Fixed by #4719
Closed
1 task done

keycloak_realm: list of dicts should be list of strings #4241

devium opened this issue Feb 21, 2022 · 4 comments · Fixed by #4719
Labels
bug This issue/PR relates to a bug has_pr identity module module plugins plugin (any type)

Comments

@devium
Copy link

devium commented Feb 21, 2022

Summary

Several keycloak_realm arguments expect list / elements=dictionary-type arguments when they should be expecting list / elements=string-type arguments:

default_default_client_scopes=dict(type='list', elements='dict', aliases=['defaultDefaultClientScopes']),
default_groups=dict(type='list', elements='dict', aliases=['defaultGroups']),
default_locale=dict(type='str', aliases=['defaultLocale']),
default_optional_client_scopes=dict(type='list', elements='dict', aliases=['defaultOptionalClientScopes']),
default_roles=dict(type='list', elements='dict', aliases=['defaultRoles']),

Since this module directly translates camelCased arguments to JSON their types should match the types specified in Keycloak's API documentation.

A similar issue was fixed in this PR:
57a4b40

Tested on Keycloak v17.0.0.

Issue Type

Bug Report

Component Name

keycloak_realm

Ansible Version

$ ansible --version
ansible [core 2.12.2]
  config file = /home/devium/code/kink/ansible.cfg
  configured module search path = ['/home/devium/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/devium/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/devium/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/devium/.local/bin/ansible
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
  jinja version = 2.10.1
  libyaml = True

Community.general Version

# /home/devium/.ansible/collections/ansible_collections
$ ansible-galaxy collection list community.general
Collection        Version
----------------- -------
community.general 4.4.0 

Configuration

$ ansible-config dump --only-changed
DEFAULT_HOST_LIST(/home/devium/code/kink/ansible.cfg) = ['/home/devium/code/kink/inventories/dev/inventory.yml']
DEFAULT_REMOTE_USER(/home/devium/code/kink/ansible.cfg) = root
DEFAULT_STDOUT_CALLBACK(/home/devium/code/kink/ansible.cfg) = debug
HOST_KEY_CHECKING(/home/devium/code/kink/ansible.cfg) = False

OS / Environment

Ubuntu 20.04 running in WSL

Steps to Reproduce

- name: Set realm's default client scopes
  community.general.keycloak_realm:
    auth_keycloak_url: https://auth.example.com/auth
    auth_realm: master
    auth_username: admin
    auth_password: changeme
    realm: myrealm
    default_default_client_scopes:
      - email
      - roles
      - web-origins

Expected Results

The realm should no longer have profile listed in its default client scopes.

Actual Results

fatal: [localhost]: FAILED! => {
    "changed": false
}

MSG:

Elements value for option 'default_default_client_scopes' is of type <class 'str'> and we were unable to convert to dict: dictionary requested, could not parse JSON or key=value

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug identity module module plugins plugin (any type) labels Feb 21, 2022
@kris2kris
Copy link
Contributor

Yes I think it's a real bug, maybe a review of code with keycloak admin documentation should be done.

@adam-cleo
Copy link
Contributor

Hi @kris2kris , some properties have been fixed already with this commit i found two more with my PR, but did not check the API in detail.

felixfontein pushed a commit that referenced this issue May 30, 2022
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment
patchback bot pushed a commit that referenced this issue May 30, 2022
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment

(cherry picked from commit 7ee15f9)
patchback bot pushed a commit that referenced this issue May 30, 2022
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment

(cherry picked from commit 7ee15f9)
felixfontein pushed a commit that referenced this issue May 30, 2022
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment

(cherry picked from commit 7ee15f9)

Co-authored-by: adam-cleo <90759784+adam-cleo@users.noreply.github.com>
felixfontein pushed a commit that referenced this issue May 30, 2022
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment

(cherry picked from commit 7ee15f9)

Co-authored-by: adam-cleo <90759784+adam-cleo@users.noreply.github.com>
This was referenced Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr identity module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants