diff --git a/changelogs/fragments/ansible-test-centos7-pypi-proxy.yml b/changelogs/fragments/ansible-test-centos7-pypi-proxy.yml new file mode 100644 index 00000000000..22a21657fcc --- /dev/null +++ b/changelogs/fragments/ansible-test-centos7-pypi-proxy.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test - Automatically enable the PyPI proxy for the ``centos7`` container to restore the ability to use ``pip`` in that container. diff --git a/test/lib/ansible_test/_internal/pypi_proxy.py b/test/lib/ansible_test/_internal/pypi_proxy.py index d119efa1ec2..d225f32f1e3 100644 --- a/test/lib/ansible_test/_internal/pypi_proxy.py +++ b/test/lib/ansible_test/_internal/pypi_proxy.py @@ -14,6 +14,7 @@ from .config import ( from .host_configs import ( PosixConfig, + DockerConfig, ) from .util import ( @@ -55,8 +56,14 @@ def run_pypi_proxy(args: EnvironmentConfig, targets_use_pypi: bool) -> None: return # user has overridden the proxy endpoint, there is nothing to provision versions_needing_proxy: tuple[str, ...] = tuple() # preserved for future use, no versions currently require this + containers_needing_proxy: set[str] = {'centos7'} posix_targets = [target for target in args.targets if isinstance(target, PosixConfig)] - need_proxy = targets_use_pypi and any(target.python.version in versions_needing_proxy for target in posix_targets) + need_proxy = targets_use_pypi and any( + target.python.version in versions_needing_proxy or + (isinstance(target, DockerConfig) and target.name in containers_needing_proxy) + for target in posix_targets + ) + use_proxy = args.pypi_proxy or need_proxy if not use_proxy: