From edf1953fd5dbc5bf222bacfd4aa5b6f72c0c6573 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 07:58:38 +0200 Subject: [PATCH] Improve API version handling. (#389) (#391) (cherry picked from commit a44e0736cfe5bfc8c40316cb761c05b906eae0c3) Co-authored-by: Felix Fontein --- changelogs/fragments/389-api-version.yml | 2 ++ plugins/module_utils/common.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/389-api-version.yml diff --git a/changelogs/fragments/389-api-version.yml b/changelogs/fragments/389-api-version.yml new file mode 100644 index 00000000..f75097a9 --- /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 e9d7c378..3882a014 100644 --- a/plugins/module_utils/common.py +++ b/plugins/module_utils/common.py @@ -309,7 +309,7 @@ class AnsibleDockerClientBase(Client): 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: