mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
This reverts commit 440cf15aeb.
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
bugfixes:
|
||||
- include_role - Only inherit from role parents in the current task dependency chain (https://github.com/ansible/ansible/issues/39543).
|
||||
- include_role - Inherit from role parents beyond a depth of 3 (https://github.com/ansible/ansible/issues/47023).
|
||||
- include_role - Inherit from role parents in the order of the task dependency chain.
|
||||
@@ -100,7 +100,11 @@ class IncludeRole(TaskInclude):
|
||||
|
||||
# compile role with parent roles as dependencies to ensure they inherit
|
||||
# variables
|
||||
dep_chain = self.get_dep_chain() or []
|
||||
if not self._parent_role:
|
||||
dep_chain = []
|
||||
else:
|
||||
dep_chain = list(self._parent_role._parents)
|
||||
dep_chain.append(self._parent_role)
|
||||
|
||||
p_block = self.build_parent_block()
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
- hosts: all
|
||||
gather_facts: no
|
||||
roles:
|
||||
- 39543_role1
|
||||
- role: 39543_role3
|
||||
when: false
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
- hosts: all
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- include_role: name=47023_role1
|
||||
@@ -1,5 +0,0 @@
|
||||
- debug:
|
||||
msg: 'role1'
|
||||
|
||||
- include_role:
|
||||
name: 39543_role2
|
||||
@@ -1,2 +0,0 @@
|
||||
- debug:
|
||||
msg: 'role2'
|
||||
@@ -1,2 +0,0 @@
|
||||
dependencies:
|
||||
- 39543_role1
|
||||
@@ -1,2 +0,0 @@
|
||||
- debug:
|
||||
msg: 'role3'
|
||||
@@ -1 +0,0 @@
|
||||
my_default: defined
|
||||
@@ -1 +0,0 @@
|
||||
- include_role: name=47023_role2
|
||||
@@ -1 +0,0 @@
|
||||
my_var: defined
|
||||
@@ -1 +0,0 @@
|
||||
- include_role: name=47023_role3
|
||||
@@ -1 +0,0 @@
|
||||
- include_role: name=47023_role4
|
||||
@@ -1,5 +0,0 @@
|
||||
- debug:
|
||||
msg: "Var is {{ my_var | default('undefined') }}"
|
||||
|
||||
- debug:
|
||||
msg: "Default is {{ my_default | default('undefined') }}"
|
||||
@@ -17,14 +17,3 @@ set -eux
|
||||
|
||||
# ensure role data is merged correctly
|
||||
ansible-playbook data_integrity.yml -i ../../inventory "$@"
|
||||
|
||||
|
||||
# ensure role vars are inherited correctly
|
||||
ANSIBLE_PRIVATE_ROLE_VARS=True ansible-playbook 39543.yml -i ../../inventory "$@" | tee out.txt
|
||||
test "$(grep '"msg": "role1"' -c out.txt)" = "1"
|
||||
test "$(grep '"msg": "role2"' -c out.txt)" = "1"
|
||||
test "$(grep '"msg": "role3"' -c out.txt)" = "0"
|
||||
|
||||
|
||||
# test nested includes get parent roles greater than a depth of 3
|
||||
[ "$(ansible-playbook 47023.yml -i ../../inventory "$@" | grep '\<\(Default\|Var\)\>' | grep -c 'is defined')" = "2" ]
|
||||
|
||||
Reference in New Issue
Block a user