diff --git a/changelogs/fragments/ansible-test-delegation-pythonpath.yml b/changelogs/fragments/ansible-test-delegation-pythonpath.yml new file mode 100644 index 00000000000..f164bc44f27 --- /dev/null +++ b/changelogs/fragments/ansible-test-delegation-pythonpath.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test - Fix traceback when running from an install and delegating execution to a different Python interpreter. diff --git a/test/lib/ansible_test/_internal/delegation.py b/test/lib/ansible_test/_internal/delegation.py index aaee0dfac0c..83ff24c0dab 100644 --- a/test/lib/ansible_test/_internal/delegation.py +++ b/test/lib/ansible_test/_internal/delegation.py @@ -53,7 +53,6 @@ from .ci import ( from .host_configs import ( OriginConfig, PythonConfig, - VirtualPythonConfig, ) from .connections import ( @@ -254,9 +253,9 @@ def generate_command( ANSIBLE_TEST_CONTENT_ROOT=content_root, ) - if isinstance(args.controller.python, VirtualPythonConfig): - # Expose the ansible and ansible_test library directories to the virtual environment. - # This is only required when running from an install. + if isinstance(args.controller, OriginConfig): + # Expose the ansible and ansible_test library directories to the Python environment. + # This is only required when delegation is used on the origin host. library_path = process_scoped_temporary_directory(args) os.symlink(ANSIBLE_LIB_ROOT, os.path.join(library_path, 'ansible'))