From 18ccec6b1012370f1a6d9208b9dac45de4dca4d0 Mon Sep 17 00:00:00 2001 From: daeseokyoun Date: Sat, 17 Apr 2021 06:53:20 +0900 Subject: [PATCH] common: correct error message for docker sdk version (#125) Annouced that 5.0.0 in Docker SDK for Python do not support Python 2.7 anymore. When the system use Python 2.7, and run "pip install docker" command to install Docker SDK for Python module. Then the 5.0.0 will be installed. When occurred the error for mismatching version for Python 2.7, the user could not feature it out why it failed. Co-authored-by: Daeseok Youn --- plugins/module_utils/common.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/module_utils/common.py b/plugins/module_utils/common.py index 5c3b79a3..02653d38 100644 --- a/plugins/module_utils/common.py +++ b/plugins/module_utils/common.py @@ -258,11 +258,15 @@ class AnsibleDockerClientBase(Client): if not HAS_DOCKER_PY: if NEEDS_DOCKER_PY2: - msg = missing_required_lib("Docker SDK for Python: docker") - msg = msg + ", for example via `pip install docker`. The error was: %s" + msg = missing_required_lib("Docker SDK for Python: docker above 5.0.0 (Python >= 3.6) or " + "docker before 5.0.0 (Python 2.7)") + msg = msg + ", for example via `pip install docker` (Python >= 3.6) or " \ + + "`pip install docker==4.4.4` (Python 2.7). The error was: %s" else: - msg = missing_required_lib("Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)") - msg = msg + ", for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: %s" + msg = missing_required_lib("Docker SDK for Python: docker above 5.0.0 (Python >= 3.6) or " + "docker before 5.0.0 (Python 2.7) or docker-py (Python 2.6)") + msg = msg + ", for example via `pip install docker` (Python >= 3.6) or `pip install docker==4.4.4` (Python 2.7) " \ + + "or `pip install docker-py` (Python 2.6). The error was: %s" self.fail(msg % HAS_DOCKER_ERROR) if self.docker_py_version < LooseVersion(min_docker_version):