mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-11 10:35:34 +00:00
clean some things up
This commit is contained in:
parent
efad552887
commit
0cf612e0ce
3 changed files with 3 additions and 32 deletions
|
|
@ -1103,7 +1103,7 @@ class KeycloakAPI:
|
|||
|
||||
def get_user_by_username(self, username: str, realm: str = "master") -> dict[str, t.Any] | None:
|
||||
"""Fetch a keycloak user within a realm based on its username.
|
||||
|
||||
|
||||
If the username is not found, None is returned.
|
||||
:param username: Username of the user to fetch.
|
||||
:param realm: Realm in which the user resides; default 'master'"""
|
||||
|
|
@ -1123,7 +1123,6 @@ class KeycloakAPI:
|
|||
except Exception as e:
|
||||
self.fail_request(e, msg=f"Could not obtain the user for realm {realm} and username {username}: {e}")
|
||||
|
||||
|
||||
def get_service_account_user_by_client_id(self, client_id, realm: str = "master"):
|
||||
"""Fetch a keycloak service account user within a realm based on its client_id.
|
||||
|
||||
|
|
|
|||
|
|
@ -104,11 +104,6 @@ EXAMPLES = r"""
|
|||
"""
|
||||
|
||||
RETURN = r"""
|
||||
msg:
|
||||
description: Textual description of whether we succeeded or failed.
|
||||
returned: always
|
||||
type: str
|
||||
|
||||
clientsecret_info:
|
||||
description: Representation of the client secret.
|
||||
returned: on success
|
||||
|
|
|
|||
|
|
@ -63,12 +63,6 @@ EXAMPLES = r"""
|
|||
"""
|
||||
|
||||
RETURN = r"""
|
||||
msg:
|
||||
description: Status message about the action performed.
|
||||
returned: always
|
||||
type: str
|
||||
sample: "Got users in realm MyCustomRealm"
|
||||
|
||||
users:
|
||||
description: List of users in the specified realm.
|
||||
returned: always
|
||||
|
|
@ -81,12 +75,6 @@ users:
|
|||
- id: "2345-6789-01"
|
||||
username: "user2"
|
||||
email: "user2@example.com"
|
||||
|
||||
changed:
|
||||
description: Indicates if any changes were made (always False, as this is a read-only operation).
|
||||
returned: always
|
||||
type: bool
|
||||
sample: false
|
||||
"""
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
|
@ -100,17 +88,9 @@ from ansible_collections.community.general.plugins.module_utils._keycloak import
|
|||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Module execution
|
||||
|
||||
:return:
|
||||
"""
|
||||
argument_spec = keycloak_argument_spec()
|
||||
meta_args = dict(
|
||||
realm=dict(default="master"),
|
||||
)
|
||||
|
||||
argument_spec.update(meta_args)
|
||||
argument_spec["realm"] = dict(default="master")
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=argument_spec,
|
||||
|
|
@ -134,10 +114,7 @@ def main():
|
|||
|
||||
realm = module.params.get("realm")
|
||||
|
||||
users = kc.get_realm_users(realm=realm)
|
||||
|
||||
result["users"] = users
|
||||
result["msg"] = f"Got users in realm {realm}"
|
||||
result["users"] = kc.get_realm_users(realm=realm)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue