From 7c5e08c0599a7bedb0cc719519a2d207417fd138 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 17 Oct 2019 13:03:21 -0700 Subject: [PATCH] [stable-2.9] Fix ansible-test env var mixing running commands. (cherry picked from commit 6be4741f722eb2d12c12bd35b16d57e3bc5410e4) Co-authored-by: Matt Clay --- changelogs/fragments/ansible-test-env-alteration.yml | 2 ++ test/lib/ansible_test/_internal/util_common.py | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/ansible-test-env-alteration.yml diff --git a/changelogs/fragments/ansible-test-env-alteration.yml b/changelogs/fragments/ansible-test-env-alteration.yml new file mode 100644 index 00000000000..2bd28d0d31e --- /dev/null +++ b/changelogs/fragments/ansible-test-env-alteration.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test now properly uses a fresh copy of environment variables for each command invocation to avoid mixing vars between commands diff --git a/test/lib/ansible_test/_internal/util_common.py b/test/lib/ansible_test/_internal/util_common.py index f4035ee9344..5be20ee749f 100644 --- a/test/lib/ansible_test/_internal/util_common.py +++ b/test/lib/ansible_test/_internal/util_common.py @@ -335,6 +335,8 @@ def intercept_command(args, cmd, target_name, env, capture=False, data=None, cwd """ if not env: env = common_environment() + else: + env = env.copy() cmd = list(cmd) version = python_version or args.python_version