summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2021-12-10 11:51:34 -0800
committerMatt Clay <matt@mystile.com>2021-12-10 12:29:13 -0800
commit470c89518ce9f45c511de8d76332a49544182da9 (patch)
treeb1c7b761457cbaac15d6736402459e8db4706e61
parentaaa10cd506b9e08b78c9c36feeddbb46f6f6905d (diff)
downloadansible-470c89518ce9f45c511de8d76332a49544182da9.tar.gz
ansible-test - Fix delegation from install.
-rw-r--r--changelogs/fragments/ansible-test-delegation-pythonpath.yml2
-rw-r--r--test/lib/ansible_test/_internal/delegation.py7
2 files changed, 5 insertions, 4 deletions
diff --git a/changelogs/fragments/ansible-test-delegation-pythonpath.yml b/changelogs/fragments/ansible-test-delegation-pythonpath.yml
new file mode 100644
index 0000000000..f164bc44f2
--- /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 aaee0dfac0..83ff24c0da 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'))