Fix ansible-test docker python version handling.

This removes the old name based version detection behavior and
uses versions defined in the docker completion file instead, as
the new containers do not follow the old naming scheme.

(cherry picked from commit 54937ba784)
This commit is contained in:
Matt Clay 2018-09-21 14:44:05 -07:00 committed by Toshio Kuratomi
parent 54d06d042e
commit cc51d93f1b
2 changed files with 6 additions and 11 deletions

View file

@ -1,11 +1,11 @@
default name=quay.io/ansible/default-test-container:1.2.0
default name=quay.io/ansible/default-test-container:1.2.0 python=3
centos6 name=quay.io/ansible/centos6-test-container:1.4.0 seccomp=unconfined
centos7 name=quay.io/ansible/centos7-test-container:1.4.0 seccomp=unconfined
fedora24 name=quay.io/ansible/fedora24-test-container:1.4.0 seccomp=unconfined
fedora25 name=quay.io/ansible/fedora25-test-container:1.4.0 seccomp=unconfined
fedora26py3 name=quay.io/ansible/fedora26py3-test-container:1.4.0
fedora27py3 name=quay.io/ansible/fedora27py3-test-container:1.4.0
fedora26py3 name=quay.io/ansible/fedora26py3-test-container:1.4.0 python=3
fedora27py3 name=quay.io/ansible/fedora27py3-test-container:1.4.0 python=3
opensuse42.3 name=quay.io/ansible/opensuse42.3-test-container:1.4.0 seccomp=unconfined
ubuntu1404 name=quay.io/ansible/ubuntu1404-test-container:1.4.0 seccomp=unconfined
ubuntu1604 name=quay.io/ansible/ubuntu1604-test-container:1.4.0 seccomp=unconfined
ubuntu1604py3 name=quay.io/ansible/ubuntu1604py3-test-container:1.4.0 seccomp=unconfined
ubuntu1604py3 name=quay.io/ansible/ubuntu1604py3-test-container:1.4.0 seccomp=unconfined python=3

View file

@ -52,6 +52,7 @@ from lib.util import (
get_available_port,
generate_pip_command,
find_python,
get_docker_completion,
)
from lib.docker_util import (
@ -1457,15 +1458,9 @@ def get_integration_docker_filter(args, targets):
display.warning('Excluding tests marked "%s" which require --docker-privileged to run under docker: %s'
% (skip.rstrip('/'), ', '.join(skipped)))
docker_image = args.docker.split('@')[0] # strip SHA for proper tag comparison
python_version = 2 # images are expected to default to python 2 unless otherwise specified
if docker_image.endswith('py3'):
python_version = 3 # docker images ending in 'py3' are expected to default to python 3
if docker_image.endswith(':default'):
python_version = 3 # docker images tagged 'default' are expected to default to python 3
python_version = int(get_docker_completion().get(args.docker_raw).get('python', str(python_version)))
if args.python: # specifying a numeric --python option overrides the default python
if args.python.startswith('3'):