mirror of https://github.com/ansible/ansible.git
omit keyword should reset to context (#78917)
* omit keyword should reset to context ensure we use context/inheritance when calculating value, using default only when context is unavailable. fixes #75692pull/78950/head
parent
20c1252212
commit
9650ddb11c
@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- omit on keywords was resetting to default value, ignoring inheritance.
|
@ -0,0 +1,29 @@
|
|||||||
|
- name: omit should reset to 'absent' or same context, not just 'default' value
|
||||||
|
hosts: testhost
|
||||||
|
gather_facts: false
|
||||||
|
become: yes
|
||||||
|
become_user: nobody
|
||||||
|
roles:
|
||||||
|
- name: setup_test_user
|
||||||
|
tasks:
|
||||||
|
- shell: whoami
|
||||||
|
register: inherited
|
||||||
|
|
||||||
|
- shell: whoami
|
||||||
|
register: explicit_no
|
||||||
|
become: false
|
||||||
|
|
||||||
|
- shell: whoami
|
||||||
|
register: omited_inheritance
|
||||||
|
become: '{{ omit }}'
|
||||||
|
|
||||||
|
- shell: whoami
|
||||||
|
register: explicit_yes
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: ensure omit works with inheritance
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- inherited.stdout == omited_inheritance.stdout
|
||||||
|
- inherited.stdout == explicit_yes.stdout
|
||||||
|
- inherited.stdout != explicit_no.stdout
|
@ -1,2 +1,3 @@
|
|||||||
shippable/posix/group5
|
shippable/posix/group5
|
||||||
|
needs/target/setup_test_user
|
||||||
context/controller
|
context/controller
|
||||||
|
Loading…
Reference in New Issue