diff --git a/changelogs/fragments/389-api-version.yml b/changelogs/fragments/389-api-version.yml new file mode 100644 index 000000000..f75097a9e --- /dev/null +++ b/changelogs/fragments/389-api-version.yml @@ -0,0 +1,2 @@ +bugfixes: + - "Docker SDK for Python based modules and plugins - if the API version is specified as an option, use that one to validate API version requirements of module/plugin options instead of the latest API version supported by the Docker daemon. This also avoids one unnecessary API call per module/plugin (https://github.com/ansible-collections/community.docker/pull/389)." diff --git a/plugins/module_utils/common.py b/plugins/module_utils/common.py index 82e3cee4a..c02a6d99a 100644 --- a/plugins/module_utils/common.py +++ b/plugins/module_utils/common.py @@ -308,7 +308,7 @@ def __init__(self, min_docker_version=None, min_docker_api_version=None): try: super(AnsibleDockerClientBase, self).__init__(**self._connect_params) - self.docker_api_version_str = self.version()['ApiVersion'] + self.docker_api_version_str = self.api_version except APIError as exc: self.fail("Docker API error: %s" % exc) except Exception as exc: