We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When I use the gitlab_user module with the latest version of python-gitlab it does not work.
gitlab_user
python-gitlab
After some investigation, python-gitlab has changed the way to access its constants and the module is not currently able to fetch with the new way.
gitlab_user module imports gitlab from module_utils https://github.com/ansible-collections/community.general/blob/main/plugins/modules/gitlab_user.py#L236
gitlab
module_utils.gitlab imports gitlab package (coming from python-gitlab) https://github.com/ansible-collections/community.general/blob/main/plugins/module_utils/gitlab.py#L26
module_utils.gitlab
In python-gitlab < 4.0.0, constants are imported in the gitlab namespace https://github.com/python-gitlab/python-gitlab/blob/v3.15.0/gitlab/__init__.py#L66
In python-gitlab >= 4.0.0, constants are not imported anymore https://github.com/python-gitlab/python-gitlab/blob/v4.1.0/gitlab/__init__.py#L46
Bug Report
ansible [core 2.15.4] config file = None configured module search path = ['/home/arnaudhatzenbuhler/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/arnaudhatzenbuhler/.local/lib/python3.10/site-packages/ansible ansible collection location = /home/arnaudhatzenbuhler/.ansible/collections:/usr/share/ansible/collections executable location = /home/arnaudhatzenbuhler/.local/bin/ansible python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (/usr/bin/python3) jinja version = 3.1.2 libyaml = True
$ ansible-galaxy collection list community.general # /usr/local/lib/python3.10/dist-packages/ansible_collections Collection Version ----------------- ------- community.general 7.4.0
$ ansible-config dump --only-changed CONFIG_FILE() = None PAGER(env: PAGER) = less
Ubuntu 22.04 for both controller and target
- name: Generate gitlab users ansible.builtin.set_fact: gitlab_users: "{{ gitlab_users | default([]) + [{'name': participant, 'password': lookup('password', '/dev/null length=32 chars=ascii_letters,digits')}] }}" loop: "{{ participants_names }}" loop_control: loop_var: participant - name: Add Gitlab users community.general.gitlab_user: email: "{{ gitlab_user.name }}@example.com" name: "{{ gitlab_user.name | replace('.', ' ') }}" username: "{{ gitlab_user.name }}" password: "{{ gitlab_user.password }}" api_url: "https://{{ gitlab_dns_name }}:8443/gitlab/" api_username: root api_password: "{{ gitlab_root_password }}" validate_certs: true confirm: false isadmin: true state: present loop: "{{ gitlab_users }}" loop_control: loop_var: gitlab_user
I expect no errors
The full traceback is: Traceback (most recent call last): File "/home/ubuntu/.ansible/tmp/ansible-tmp-1699015553.5655625-352593-158252277358778/AnsiballZ_gitlab_user.py", line 107, in <module> _ansiballz_main() File "/home/ubuntu/.ansible/tmp/ansible-tmp-1699015553.5655625-352593-158252277358778/AnsiballZ_gitlab_user.py", line 99, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/home/ubuntu/.ansible/tmp/ansible-tmp-1699015553.5655625-352593-158252277358778/AnsiballZ_gitlab_user.py", line 47, in invoke_module runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.gitlab_user', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.gitlab_user', _modlib_path=modlib_path), File "/usr/lib/python3.10/runpy.py", line 224, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code _run_code(code, mod_globals, init_globals, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/tmp/ansible_community.general.gitlab_user_payload_qn14odzl/ansible_community.general.gitlab_user_payload.zip/ansible_collections/community/general/plugins/modules/gitlab_user.py", line 691, in <module> File "/tmp/ansible_community.general.gitlab_user_payload_qn14odzl/ansible_community.general.gitlab_user_payload.zip/ansible_collections/community/general/plugins/modules/gitlab_user.py", line 640, in main File "/tmp/ansible_community.general.gitlab_user_payload_qn14odzl/ansible_community.general.gitlab_user_payload.zip/ansible_collections/community/general/plugins/modules/gitlab_user.py", line 247, in __init__ AttributeError: module 'gitlab' has no attribute 'GUEST_ACCESS' failed: [15.236.13.100] (item={'name': 'arnaud.hatzenbuhler', 'password': 'xxxxxxxx'}) => { "ansible_loop_var": "gitlab_user", "changed": false, "gitlab_user": { "name": "arnaud.hatzenbuhler", "password": "xxxxxxxxx" }, "module_stderr": "OpenSSH_8.9p1 Ubuntu-3ubuntu0.4, OpenSSL 3.0.2 15 Mar 2022\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 15.236.13.100 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/arnaudhatzenbuhler/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/arnaudhatzenbuhler/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 351238\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to 15.236.13.100 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/home/ubuntu/.ansible/tmp/ansible-tmp-1699015553.5655625-352593-158252277358778/AnsiballZ_gitlab_user.py\", line 107, in <module>\r\n _ansiballz_main()\r\n File \"/home/ubuntu/.ansible/tmp/ansible-tmp-1699015553.5655625-352593-158252277358778/AnsiballZ_gitlab_user.py\", line 99, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/ubuntu/.ansible/tmp/ansible-tmp-1699015553.5655625-352593-158252277358778/AnsiballZ_gitlab_user.py\", line 47, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.gitlab_user', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.gitlab_user', _modlib_path=modlib_path),\r\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\r\n _run_code(code, mod_globals, init_globals,\r\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\r\n exec(code, run_globals)\r\n File \"/tmp/ansible_community.general.gitlab_user_payload_qn14odzl/ansible_community.general.gitlab_user_payload.zip/ansible_collections/community/general/plugins/modules/gitlab_user.py\", line 691, in <module>\r\n File \"/tmp/ansible_community.general.gitlab_user_payload_qn14odzl/ansible_community.general.gitlab_user_payload.zip/ansible_collections/community/general/plugins/modules/gitlab_user.py\", line 640, in main\r\n File \"/tmp/ansible_community.general.gitlab_user_payload_qn14odzl/ansible_community.general.gitlab_user_payload.zip/ansible_collections/community/general/plugins/modules/gitlab_user.py\", line 247, in __init__\r\nAttributeError: module 'gitlab' has no attribute 'GUEST_ACCESS'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }
The text was updated successfully, but these errors were encountered:
Files identified in the description:
plugins/modules/gitlab_user.py
If these files are incorrect, please update the component name section of the description or use the !component bot command.
component name
!component
click here for bot help
Sorry, something went wrong.
cc @LennertMertens @Lunik @Shaps @lgatellier @marwatk @metanovii @nejch @scodeman @sh0shin @stgrace @suukit @waheedi @zanssa click here for bot help
resolved_by_pr 7467
No branches or pull requests
Summary
When I use the
gitlab_user
module with the latest version ofpython-gitlab
it does not work.After some investigation, python-gitlab has changed the way to access its constants and the module is not currently able to fetch with the new way.
gitlab_user
module importsgitlab
from module_utilshttps://github.com/ansible-collections/community.general/blob/main/plugins/modules/gitlab_user.py#L236
module_utils.gitlab
importsgitlab
package (coming from python-gitlab)https://github.com/ansible-collections/community.general/blob/main/plugins/module_utils/gitlab.py#L26
In python-gitlab < 4.0.0, constants are imported in the gitlab namespace
https://github.com/python-gitlab/python-gitlab/blob/v3.15.0/gitlab/__init__.py#L66
In python-gitlab >= 4.0.0, constants are not imported anymore
https://github.com/python-gitlab/python-gitlab/blob/v4.1.0/gitlab/__init__.py#L46
Issue Type
Bug Report
Component Name
gitlab_user
Ansible Version
Community.general Version
Configuration
OS / Environment
Ubuntu 22.04 for both controller and target
Steps to Reproduce
Expected Results
I expect no errors
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: