diff --git a/changelogs/fragments/620-bugfixes.yml b/changelogs/fragments/620-bugfixes.yml new file mode 100644 index 00000000..982b0744 --- /dev/null +++ b/changelogs/fragments/620-bugfixes.yml @@ -0,0 +1,2 @@ +bugfixes: + - "socket_handler module utils - make sure this fully works when Docker SDK for Python is not available (https://github.com/ansible-collections/community.docker/pull/620)." diff --git a/plugins/module_utils/socket_handler.py b/plugins/module_utils/socket_handler.py index f4a3ef79..878dc7c5 100644 --- a/plugins/module_utils/socket_handler.py +++ b/plugins/module_utils/socket_handler.py @@ -9,15 +9,11 @@ __metaclass__ = type import os import os.path import socket as pysocket +import struct from ansible.module_utils.six import PY2 -try: - from docker.utils import socket as docker_socket - import struct -except Exception: - # missing Docker SDK for Python handled in ansible_collections.community.docker.plugins.module_utils.common - pass +from ansible_collections.community.docker.plugins.module_utils._api.utils import socket as docker_socket from ansible_collections.community.docker.plugins.module_utils.socket_helper import ( make_unblocking,