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

Add new module managing keycloak user #52327

Open
wants to merge 7 commits into
base: devel
from

Conversation

Projects
None yet
4 participants
@ndclt
Copy link

ndclt commented Feb 15, 2019

SUMMARY

This module (keycloak_user) allows the use of the Keycloak REST API (http://www.keycloak.org/docs-api/3.4/rest-api/index.html) to administrate Keycloak (http://www.keycloak.org) user.

Keycloak is an Open Source Identity and Access Management system spearheaded by Red Hat. It provides OpenID Connect and SAML authentication/authorization services.

Two prior modules in this namespace have been merged (keycloak_client in #31716 and keycloak_clienttemplate in #33419). This module reuses code introduced therein (from module_utils/keycloak.py).
Three other modules currently have new module PRs pending (keycloak_group in #35637 by @adamgoossens, keycloak_scope in #35558 by @eikef, keycloak_realms in #)#35844; they extend module_utils/keycloak.py as well, though it's all strictly additions.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

keycloak_user

@mattclay

This comment has been minimized.

Copy link
Member

mattclay commented Feb 15, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 15, 2019

The test ansible-test sanity --test pylint [explain] failed with 4 errors:

lib/ansible/module_utils/keycloak.py:407:0: trailing-whitespace Trailing whitespace
lib/ansible/module_utils/keycloak.py:421:0: trailing-whitespace Trailing whitespace
lib/ansible/module_utils/keycloak.py:450:0: trailing-whitespace Trailing whitespace
lib/ansible/module_utils/keycloak.py:484:0: trailing-whitespace Trailing whitespace

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/modules/identity/keycloak/keycloak_user.py:306:8: useless-else-on-loop Else clause on loop without a break statement

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.8 [explain] failed with 1 error:

lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
cat _themes/srtd/static/css/theme.css | sed -e 's/^[ 	]*//g; s/[ 	]*$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$/d' | sed -e :a -e '$!N; s/\n\(.\)/\1/; ta' > _themes/srtd/static/css/theme.min.css
PYTHONPATH=../../lib ../bin/dump_config.py --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ -d ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../bin/generate_man.py --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml
PYTHONPATH=../../lib ../bin/plugin_formatter.py -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Evaluating module files...
Makefile:93: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../bin/plugin_formatter.py", line 774, in <module>
    main()
  File "../bin/plugin_formatter.py", line 729, in main
    plugin_info, categories = get_plugin_info(options.module_dir, limit_to=options.limit_to, verbose=(options.verbosity > 0))
  File "../bin/plugin_formatter.py", line 294, in get_plugin_info
    doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose)
  File "/root/ansible/lib/ansible/utils/plugin_docs.py", line 103, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/root/ansible/lib/ansible/parsing/plugin_docs.py", line 59, in read_docstring
    data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
  File "/usr/local/lib/python3.6/dist-packages/yaml/constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/local/lib/python3.6/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/local/lib/python3.6/dist-packages/yaml/parser.py", line 428, in parse_block_mapping_key
    if self.check_token(KeyToken):
  File "/usr/local/lib/python3.6/dist-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/usr/local/lib/python3.6/dist-packages/yaml/scanner.py", line 220, in fetch_more_tokens
    return self.fetch_value()
  File "/usr/local/lib/python3.6/dist-packages/yaml/scanner.py", line 576, in fetch_value
    self.get_mark())
yaml.scanner.ScannerError: mapping values are not allowed here
  in "<unicode string>", line 38, column 33:
                if you send {'a key': 'some value'} when updated, th ... 
                                    ^
make: *** [modules] Error 1

The test ansible-test sanity --test no-underscore-variable [explain] failed with 1 error:

test/units/modules/identity/keycloak/test_keycloak_user.py:320:21: use `dummy` instead of `_` for a variable name

The test ansible-test sanity --test pep8 [explain] failed with 29 errors:

lib/ansible/module_utils/keycloak.py:359:39: E128 continuation line under-indented for visual indent
lib/ansible/module_utils/keycloak.py:407:1: W293 blank line contains whitespace
lib/ansible/module_utils/keycloak.py:421:1: W293 blank line contains whitespace
lib/ansible/module_utils/keycloak.py:450:1: W293 blank line contains whitespace
lib/ansible/module_utils/keycloak.py:484:1: W293 blank line contains whitespace
lib/ansible/module_utils/keycloak.py:504:39: E128 continuation line under-indented for visual indent
lib/ansible/modules/identity/keycloak/keycloak_user.py:19:76: W291 trailing whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:29:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:43:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:47:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:50:74: W291 trailing whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:51:74: W291 trailing whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:52:77: W291 trailing whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:53:78: W291 trailing whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:56:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:61:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:66:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:72:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:78:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:85:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:88:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:94:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:98:1: W293 blank line contains whitespace
lib/ansible/modules/identity/keycloak/keycloak_user.py:101:33: W291 trailing whitespace
test/units/modules/identity/keycloak/test_keycloak_user.py:272:13: E126 continuation line over-indented for hanging indent
test/units/modules/identity/keycloak/test_keycloak_user.py:277:9: E121 continuation line under-indented for hanging indent
test/units/modules/identity/keycloak/test_keycloak_user.py:305:13: E124 closing bracket does not match visual indentation
test/units/modules/identity/keycloak/test_keycloak_user.py:324:13: E126 continuation line over-indented for hanging indent
test/units/modules/identity/keycloak/test_keycloak_user.py:330:9: E121 continuation line under-indented for hanging indent

The test ansible-test sanity --test validate-modules [explain] failed with 9 errors:

lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: E324 Value for "default" from the argument_spec ('admin-cli') for "auth_client_id" does not match the documentation (None)
lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: E324 Value for "default" from the argument_spec ('master') for "realm" does not match the documentation (None)
lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: E324 Value for "default" from the argument_spec ('present') for "state" does not match the documentation (None)
lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: E324 Value for "default" from the argument_spec (True) for "validate_certs" does not match the documentation (False)
lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: E325 argument_spec for "email_verified" defines type="bool" but documentation does not
lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: E325 argument_spec for "enabled" defines type="bool" but documentation does not
lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: E325 argument_spec for "validate_certs" defines type="bool" but documentation does not
lib/ansible/modules/identity/keycloak/keycloak_user.py:0:0: E326 Value for "choices" from the argument_spec (['present', 'absent']) for "state" does not match the documentation ([])
lib/ansible/modules/identity/keycloak/keycloak_user.py:52:33: E302 DOCUMENTATION is not valid YAML

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/identity/keycloak/keycloak_user.py:52:33: error DOCUMENTATION: syntax error: mapping values are not allowed here

click here for bot help

change documentation and mocks for all python versions
- rename _ into dummy
- pep8
- update documentation
- change mock creation
@ndclt

This comment has been minimized.

Copy link
Author

ndclt commented Feb 17, 2019

CI failure in unit tests: https://app.shippable.com/github/ansible/ansible/runs/107731/6/tests

@mattclay thank you for your message. My last commit should avoid the previous failures.

@ansibot ansibot removed the ci_verified label Feb 17, 2019

ndclt added some commits Feb 17, 2019

delete test about list for required actions
This is manage by ansible module thus the test and the check are useless

@ansibot ansibot added core_review and removed needs_revision labels Feb 17, 2019

ndclt and others added some commits Feb 19, 2019

keycloak: Clean up parameter types (#52542)
This PR includes:
- Parameter types added
- Copyright format fixes
- Short license statement

This breaks out PR #52182
# Conflicts:
#	lib/ansible/plugins/doc_fragments/keycloak.py

@ansibot ansibot added needs_revision and removed core_review labels Feb 20, 2019

@ndclt

This comment has been minimized.

Copy link
Author

ndclt commented Feb 20, 2019

The CI failed because of the test under T=freebsd/12.0/1. When I look at the errors, it does not seem to be related to my code and I don't know what to do.

Am I wrong?

Manage attributes with one element in a list and update doc.
doc: update with modifications seen in #52438

@ansibot ansibot removed the stale_ci label Mar 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.