mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-21 03:23:59 -07:00
Skip self._parent on dynamic, defer to grandparent for attr lookup (#38827)
* Skip self._parent on dynamic, defer to grandparent for attr lookup * Revert _inheritable * Add tests for include inheritance from static blocks Fixes #38037 #36194
This commit is contained in:
parent
1d5c933ecf
commit
354aa8d602
11 changed files with 63 additions and 16 deletions
|
@ -0,0 +1,2 @@
|
|||
- command: "true"
|
||||
register: block_include_result
|
|
@ -0,0 +1 @@
|
|||
- include_tasks: include_level_1.yml
|
|
@ -0,0 +1,2 @@
|
|||
- command: "true"
|
||||
register: import_include_include_result
|
|
@ -0,0 +1 @@
|
|||
- include_tasks: import_include_include_tasks.yml
|
|
@ -55,3 +55,7 @@ gen_task_files
|
|||
ANSIBLE_STRATEGY='linear' ansible-playbook test_copious_include_tasks.yml -i ../../inventory "$@" --skip-tags never
|
||||
ANSIBLE_STRATEGY='free' ansible-playbook test_copious_include_tasks.yml -i ../../inventory "$@" --skip-tags never
|
||||
rm -f tasks/hello/*.yml
|
||||
|
||||
# Inlcuded tasks should inherit attrs from non-dynamic blocks in parent chain
|
||||
# https://github.com/ansible/ansible/pull/38827
|
||||
ANSIBLE_STRATEGY='linear' ansible-playbook test_grandparent_inheritance.yml -i ../../inventory "$@"
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- debug:
|
||||
var: inventory_hostname
|
||||
|
||||
- name: Test included tasks inherit from block
|
||||
check_mode: true
|
||||
block:
|
||||
- include_tasks: grandchild/block_include_tasks.yml
|
||||
|
||||
- debug:
|
||||
var: block_include_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- block_include_result is skipped
|
||||
|
||||
- name: Test included tasks inherit deeply from import
|
||||
import_tasks: grandchild/import.yml
|
||||
check_mode: true
|
||||
|
||||
- debug:
|
||||
var: import_include_include_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- import_include_include_result is skipped
|
Loading…
Add table
Add a link
Reference in a new issue