Skip to content

Commit

Permalink
common: correct error message for docker sdk version (#125)
Browse files Browse the repository at this point in the history
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 <daeseok.youn@navercorp.com>
  • Loading branch information
daeseokyoun and Daeseok Youn authored Apr 16, 2021
1 parent 90dbdbc commit 18ccec6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions plugins/module_utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,15 @@ def __init__(self, min_docker_version=None, min_docker_api_version=None):

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):
Expand Down

0 comments on commit 18ccec6

Please sign in to comment.