summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2022-10-06 15:55:56 +0200
committerGitHub <noreply@github.com>2022-10-06 15:55:56 +0200
commit420564c5bcf752a821ae0599c3bd01ffba40f3ea (patch)
tree48d08ccb0c0fd0d972c49a4d7d0f60eb84cde4de /test
parentfacts: List all local (scope host) IP address ranges (#79018) (diff)
downloadansible-420564c5bcf752a821ae0599c3bd01ffba40f3ea.tar.xz
ansible-420564c5bcf752a821ae0599c3bd01ffba40f3ea.zip
Ensure that we do not squash keywords in validate (#79049)
* Ensure that we do not squash keywords in validate. Fixes #79021 * become_user: nobody should only apply to the test tasks, not the setup_test_user role * Update how become_user is specified * Add test to ensure keyword inheritance is working for become * Add clog frag * Cache fattributes to prevent re-calculation * ci_complete * Remove unnecessary getattr
Diffstat (limited to 'test')
-rw-r--r--test/integration/targets/keyword_inheritance/aliases3
-rw-r--r--test/integration/targets/keyword_inheritance/roles/whoami/tasks/main.yml3
-rwxr-xr-xtest/integration/targets/keyword_inheritance/runme.sh5
-rw-r--r--test/integration/targets/keyword_inheritance/test.yml8
-rw-r--r--test/integration/targets/omit/75692.yml2
5 files changed, 21 insertions, 0 deletions
diff --git a/test/integration/targets/keyword_inheritance/aliases b/test/integration/targets/keyword_inheritance/aliases
new file mode 100644
index 0000000000..a6a33411a3
--- /dev/null
+++ b/test/integration/targets/keyword_inheritance/aliases
@@ -0,0 +1,3 @@
+shippable/posix/group4
+context/controller
+needs/target/setup_test_user
diff --git a/test/integration/targets/keyword_inheritance/roles/whoami/tasks/main.yml b/test/integration/targets/keyword_inheritance/roles/whoami/tasks/main.yml
new file mode 100644
index 0000000000..80252c0354
--- /dev/null
+++ b/test/integration/targets/keyword_inheritance/roles/whoami/tasks/main.yml
@@ -0,0 +1,3 @@
+- command: whoami
+ register: result
+ failed_when: result.stdout_lines|first != 'ansibletest0'
diff --git a/test/integration/targets/keyword_inheritance/runme.sh b/test/integration/targets/keyword_inheritance/runme.sh
new file mode 100755
index 0000000000..6b78a06dc4
--- /dev/null
+++ b/test/integration/targets/keyword_inheritance/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -eux
+
+ANSIBLE_ROLES_PATH=../ ansible-playbook -i ../../inventory test.yml "$@"
diff --git a/test/integration/targets/keyword_inheritance/test.yml b/test/integration/targets/keyword_inheritance/test.yml
new file mode 100644
index 0000000000..886f9858ff
--- /dev/null
+++ b/test/integration/targets/keyword_inheritance/test.yml
@@ -0,0 +1,8 @@
+- hosts: testhost
+ gather_facts: false
+ become_user: ansibletest0
+ become: yes
+ roles:
+ - role: setup_test_user
+ become_user: root
+ - role: whoami
diff --git a/test/integration/targets/omit/75692.yml b/test/integration/targets/omit/75692.yml
index eaabd97881..5ba8a2df1b 100644
--- a/test/integration/targets/omit/75692.yml
+++ b/test/integration/targets/omit/75692.yml
@@ -2,9 +2,11 @@
hosts: testhost
gather_facts: false
become: yes
+ # become_user needed at play level for testing this behavior
become_user: nobody
roles:
- name: setup_test_user
+ become_user: root
tasks:
- shell: whoami
register: inherited