mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Get docker's default api version definition from both 1.2 location and pre-1.2 location
Fixes #1227
This commit is contained in:
parent
018b0118dc
commit
0d468a3aa0
1 changed files with 8 additions and 3 deletions
|
@ -377,6 +377,13 @@ if HAS_DOCKER_PY:
|
||||||
from docker.errors import APIError as DockerAPIError
|
from docker.errors import APIError as DockerAPIError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from docker.client import APIError as DockerAPIError
|
from docker.client import APIError as DockerAPIError
|
||||||
|
try:
|
||||||
|
# docker-py 1.2+
|
||||||
|
import docker.constants
|
||||||
|
DEFAULT_DOCKER_API_VERSION = docker.constants.DEFAULT_DOCKER_API_VERSION
|
||||||
|
except (ImportError, AttributeError):
|
||||||
|
# docker-py less than 1.2
|
||||||
|
DEFAULT_DOCKER_API_VERSION = docker.client.DEFAULT_DOCKER_API_VERSION
|
||||||
|
|
||||||
|
|
||||||
def _human_to_bytes(number):
|
def _human_to_bytes(number):
|
||||||
|
@ -567,9 +574,7 @@ class DockerManager(object):
|
||||||
else:
|
else:
|
||||||
docker_url = 'unix://var/run/docker.sock'
|
docker_url = 'unix://var/run/docker.sock'
|
||||||
|
|
||||||
docker_api_version = module.params.get('docker_api_version')
|
docker_api_version = module.params.get('docker_api_version', DEFAULT_DOCKER_API_VERSION)
|
||||||
if not docker_api_version:
|
|
||||||
docker_api_version=docker.client.DEFAULT_DOCKER_API_VERSION
|
|
||||||
|
|
||||||
tls_client_cert = module.params.get('tls_client_cert', None)
|
tls_client_cert = module.params.get('tls_client_cert', None)
|
||||||
if not tls_client_cert and env_cert_path:
|
if not tls_client_cert and env_cert_path:
|
||||||
|
|
Loading…
Reference in a new issue