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

Get an error when trying to use community.docker.docker_container_info with latest version requests #635

Closed
iceadler opened this issue May 22, 2023 · 1 comment

Comments

@iceadler
Copy link

SUMMARY

We use ansible module community.docker.docker_container_info. And get error:
" Error connecting: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked' "

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.docker.docker_container_info

ANSIBLE VERSION
Ansible version 2.14.15
COLLECTION VERSION
Collection       Version
---------------- -------
community.docker 3.4.0  
CONFIGURATION
CALLBACKS_ENABLED(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = ['profile_tasks', 'profile_roles', 'timer']
COLLECTIONS_PATHS(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = ['/home/o.zejbel/ansible_projects/playbooks/collections']
CONFIG_FILE() = /home/o.zejbel/ansible_projects/playbooks/ansible.cfg
DEFAULT_FORKS(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = 20
DEFAULT_HOST_LIST(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = ['/home/o.zejbel/ansible_projects/playbooks/inventory.ini']
DEFAULT_MANAGED_STR(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = Ansible managed: Do NOT edit this file manually!
DEFAULT_ROLES_PATH(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = ['/home/o.zejbel/ansible_projects/playbooks/roles']
DEFAULT_STDOUT_CALLBACK(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = debug
DEFAULT_UNDEFINED_VAR_BEHAVIOR(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = True
DEFAULT_VARS_PLUGIN_PATH(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = ['/home/o.zejbel/ansible_projects/playbooks/plugins/vars']
DIFF_ALWAYS(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = True
HOST_KEY_CHECKING(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = False
INVENTORY_IGNORE_EXTS(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = ['~', '.orig', '.bak', '.cfg', '.retry', '.pyc', '.pyo', '.md']
INVENTORY_IGNORE_PATTERNS(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = ['artifacts', 'credentials', 'vault.yml']
RETRY_FILES_ENABLED(/home/o.zejbel/ansible_projects/playbooks/ansible.cfg) = True
OS / ENVIRONMENT

Linux Fedora 37

STEPS TO REPRODUCE
docker version 20.10.20
docker API version: 1.41
request 2.30 (latest)

Simple playbook

- hosts: all
  tasks:
    - name: Check container 
      register: _docker_container
      community.docker.docker_container_info:
        name: docker-promtail_promtail_1
      vars:
        ansible_python_interpreter: "/opt/docker-promtail/venv/bin/python3"
    - name: Debug
      ansible.builtin.debug:
        msg: "{{ _docker_container  }}"

We get errors
fatal: [db02-notifications.robocash.global]: FAILED! => {
    "changed": false
}
MSG:
Error connecting: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'

Buti If we downgrade request form 2.30 to 2.28.2 result successful
EXPECTED RESULTS

Get docker containers info without errors

ACTUAL RESULTS
The full traceback is:
  File "/tmp/ansible_community.docker.docker_container_info_payload_w4un0yo7/ansible_community.docker.docker_container_info_payload.zip/ansible_collections/community/docker/plugins/module_utils/common_api.py", line 118, in __init__
    super(AnsibleDockerClientBase, self).__init__(**self._connect_params)
  File "/tmp/ansible_community.docker.docker_container_info_payload_w4un0yo7/ansible_community.docker.docker_container_info_payload.zip/ansible_collections/community/docker/plugins/module_utils/_api/api/client.py", line 188, in __init__
    self._version = self._retrieve_server_version()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_community.docker.docker_container_info_payload_w4un0yo7/ansible_community.docker.docker_container_info_payload.zip/ansible_collections/community/docker/plugins/module_utils/_api/api/client.py", line 212, in _retrieve_server_version
    raise DockerException(

@felixfontein
Copy link
Collaborator

See #611, you need to update community.docker, or alternatively downgrade requests and/or urllib3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants