summaryrefslogtreecommitdiff
path: root/test/integration/targets/gathering_facts
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2020-08-07 18:07:43 -0400
committerGitHub <noreply@github.com>2020-08-07 17:07:43 -0500
commit4a6a9acea878225eba8e18af926fbd450e68c2b4 (patch)
tree9a7d83006a7506dc170171594b4f1dd463e2e4db /test/integration/targets/gathering_facts
parent6e8adc05263df4bad6d45eeeb85646438dde333b (diff)
downloadansible-4a6a9acea878225eba8e18af926fbd450e68c2b4.tar.gz
dont clobber facts in loop (#71032) (#71096)
* dont clobber facts in loop fixes #71031 (cherry picked from commit f9af27c6317d46f262aa146aa491aa42cc3204bb)
Diffstat (limited to 'test/integration/targets/gathering_facts')
-rw-r--r--test/integration/targets/gathering_facts/prevent_clobbering.yml8
-rwxr-xr-xtest/integration/targets/gathering_facts/runme.sh3
2 files changed, 11 insertions, 0 deletions
diff --git a/test/integration/targets/gathering_facts/prevent_clobbering.yml b/test/integration/targets/gathering_facts/prevent_clobbering.yml
new file mode 100644
index 0000000000..94bb451200
--- /dev/null
+++ b/test/integration/targets/gathering_facts/prevent_clobbering.yml
@@ -0,0 +1,8 @@
+- name: Verify existing facts don't go undefined on unrelated new facts in loop
+ hosts: localhost
+ gather_facts: True
+ tasks:
+ - name: Ensure that 'virtualization_type' is not undefined after first loop iteration
+ bogus_facts:
+ loop: [1, 2, 3]
+ when: ansible_facts['virtualization_type'] != 'NotDocker'
diff --git a/test/integration/targets/gathering_facts/runme.sh b/test/integration/targets/gathering_facts/runme.sh
index ccea766281..143a796479 100755
--- a/test/integration/targets/gathering_facts/runme.sh
+++ b/test/integration/targets/gathering_facts/runme.sh
@@ -10,3 +10,6 @@ ANSIBLE_GATHERING=smart ansible-playbook test_run_once.yml -i inventory -v "$@"
# ensure clean_facts is working properly
ansible-playbook test_prevent_injection.yml -i inventory -v "$@"
+
+# ensure we dont clobber facts in loop
+ansible-playbook prevent_clobbering.yml -v "$@"