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

ansible.module_utils.compat.selectors module is deprecated #870

Closed
kstephan-wescale opened this issue May 24, 2024 · 2 comments · Fixed by #871
Closed

ansible.module_utils.compat.selectors module is deprecated #870

kstephan-wescale opened this issue May 24, 2024 · 2 comments · Fixed by #871
Labels
bug Something isn't working docker-plain plain Docker (no swarm, no compose, no stack)

Comments

@kstephan-wescale
Copy link

SUMMARY

The docker_container_exec module throws a deprecation warning regarding ansible.module_utils.compat.selectors.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

docker_container_exec

ANSIBLE VERSION
ansible [core 2.17.0]
  config file = /PATH/TO/ansible.cfg
  configured module search path = ['/PATH/TO/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /PATH/TO/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417] (/usr/bin/python)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
# /usr/lib/python3.12/site-packages/ansible_collections
Collection       Version
---------------- -------
community.docker 3.10.1
CONFIGURATION
CONFIG_FILE() = /PATH/TO/ansible.cfg
EDITOR(env: EDITOR) = nvim
VARIABLE_PLUGINS_ENABLED(/PATH/TO/ansible.cfg) = ['host_group_vars', 'community.sops.sops']
OS / ENVIRONMENT

Ubuntu 22.04 target

STEPS TO REPRODUCE
- name: hup nginx
  community.docker.docker_container_exec:
    container: gitlab
    command: gitlab-ctl hup nginx
EXPECTED RESULTS

Ansible doesn’t warn about a supposedly soon-to-be removed feature.

ACTUAL RESULTS

Ansible throws this warning:

[DEPRECATION WARNING]: The `ansible.module_utils.compat.selectors` module is deprecated. This feature will be removed in version 2.19. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
@felixfontein
Copy link
Collaborator

Thanks for spotting and reporting that!

The compat module was stripped down here: ansible/ansible@d2ba76c The reason is that ansible-core dropped Python 2.7 support. This collection still supports Python 2.7, so we'll likely have to vendor the old code to avoid triggering that deprecation warning.

Or alternatively only import that module util for Python < 3, since then it's clear that an ansible-core version is used that still fully supports the compat module.

@felixfontein felixfontein added bug Something isn't working docker-plain plain Docker (no swarm, no compose, no stack) labels May 24, 2024
@felixfontein
Copy link
Collaborator

#871 fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker-plain plain Docker (no swarm, no compose, no stack)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants