-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
New Module: Keycloak ClientSecret #3997
New Module: Keycloak ClientSecret #3997
Conversation
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Felix Fontein <felix@fontein.de>
|
||
try: | ||
return json.loads(to_native(open_url(clientsecret_url, method='POST', headers=self.restheaders, | ||
validate_certs=self.validate_certs).read())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (and others) need to be adjusted similar to #4178.
needs_info |
This New Module PR contains a symbolic link from plugins/modules/ to the actual Python file. Since #4562 this is no longer necessary and will soon be flagged as an error. Instead you need to add an entry to meta/runtime.yml, similar to this one: https://github.com/ansible-collections/community.general/blob/main/meta/runtime.yml#L21-L22 See also our updated instructions on creating new modules: https://github.com/ansible-collections/community.general/blob/main/CONTRIBUTING.md#creating-new-modules-or-plugins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fynncfchen , thanks for your contribution. I am leaving a couple of suggestions around, but they don't affect the outcome of the module itself. Other than that (and Felix's comments), looking good.
''' | ||
|
||
RETURN = ''' | ||
msg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be Nice-to-Have(TM) consistency in the indentation on the YAML blocks. In some places it is 2 spaces, in others 4 spaces.
result['end_state'] = clientsecret | ||
result['msg'] = 'Get client secret successful for ID {id}'.format(id=id) | ||
|
||
module.exit_json(**result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is redundant, as the exact same command will run after the if-else
block in line 232
result['changed'] = False | ||
result['end_state'] = {} | ||
result['msg'] = 'State not specified; doing nothing.' | ||
module.exit_json(**result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is redundant, as the exact same command will run after the if-else
block in line 232
# only lookup the client_id if id isn't provided. | ||
# in the case that both are provided, prefer the ID, since it's one | ||
# less lookup. | ||
if id is None and client_id is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the required_one_of
spec in the Module, on line 165, this could be simplified to:
if id is None and client_id is not None: | |
if id is None: |
|
||
argument_spec.update(meta_args) | ||
|
||
module = AnsibleModule(argument_spec=argument_spec, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the examples, it looks like one must pass (auth_realm, auth_username, auth_password)
or token
, but not both.
If that's indeed the case, there should be a mutually_exclusive
clause here.
@fynncfchen This pullrequest is waiting for your response. Please respond or the pullrequest will be closed. |
@fynncfchen You have not responded to information requests in this pullrequest so we will assume it no longer affects you. If you are still interested in this, please create a new pullrequest with the requested information. |
Docs Build 📝This PR is closed and any previously published docsite has been unpublished. |
I would find the functionality in this PR by @fynncfchen useful. @russoz - would you merge if I made your changes? |
Hi @johncant , that's the purpose of PRs :). Just read it carefully, as Felix has also requested some changes as well. |
Thanks @russoz @felixfontein @fynncfchen - now done! |
SUMMARY
Add
keycloak_clientsecret
to provide management of client secret via Keycloak Admin API.ISSUE TYPE
COMPONENT NAME
keycloak_clientsecret
ADDITIONAL INFORMATION
Example: