mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
docker: fix parsing of docker __version__ string
If `docker.__version__` contains non-digit characters, such as: >>> import docker >>> docker.__version__ '1.4.0-dev' Then `get_docker_py_versioninfo` will fail with: ValueError: invalid literal for int() with base 10: '0-de' This patch corrects the parsing of the version string so that `get_docker_py_versioninfo` in this example would return: (1, 4, 0, '-dev')
This commit is contained in:
parent
9623cd570c
commit
562341049e
1 changed files with 1 additions and 0 deletions
|
@ -524,6 +524,7 @@ def get_docker_py_versioninfo():
|
||||||
if not char.isdigit():
|
if not char.isdigit():
|
||||||
nondigit = part[idx:]
|
nondigit = part[idx:]
|
||||||
digit = part[:idx]
|
digit = part[:idx]
|
||||||
|
break
|
||||||
if digit:
|
if digit:
|
||||||
version.append(int(digit))
|
version.append(int(digit))
|
||||||
if nondigit:
|
if nondigit:
|
||||||
|
|
Loading…
Reference in a new issue