Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
6dd38c2a
Commit
6dd38c2a
authored
Sep 26, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix parent attribute lookup to be default
Fixes #12526
parent
a1c38a3f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletions
+15
-1
lib/ansible/playbook/base.py
+4
-1
lib/ansible/playbook/block.py
+5
-0
lib/ansible/playbook/task.py
+6
-0
No files found.
lib/ansible/playbook/base.py
View file @
6dd38c2a
...
@@ -105,7 +105,10 @@ class Base:
...
@@ -105,7 +105,10 @@ class Base:
if
hasattr
(
self
,
method
):
if
hasattr
(
self
,
method
):
return
getattr
(
self
,
method
)()
return
getattr
(
self
,
method
)()
return
self
.
_attributes
[
prop_name
]
value
=
self
.
_attributes
[
prop_name
]
if
value
is
None
and
hasattr
(
self
,
'_get_parent_attribute'
):
value
=
self
.
_get_parent_attribute
(
prop_name
)
return
value
@staticmethod
@staticmethod
def
_generic_s
(
prop_name
,
self
,
value
):
def
_generic_s
(
prop_name
,
self
,
value
):
...
...
lib/ansible/playbook/block.py
View file @
6dd38c2a
...
@@ -271,7 +271,10 @@ class Block(Base, Become, Conditional, Taggable):
...
@@ -271,7 +271,10 @@ class Block(Base, Become, Conditional, Taggable):
Generic logic to get the attribute or parent attribute for a block value.
Generic logic to get the attribute or parent attribute for a block value.
'''
'''
value
=
None
try
:
value
=
self
.
_attributes
[
attr
]
value
=
self
.
_attributes
[
attr
]
if
self
.
_parent_block
and
(
value
is
None
or
extend
):
if
self
.
_parent_block
and
(
value
is
None
or
extend
):
parent_value
=
getattr
(
self
.
_parent_block
,
attr
)
parent_value
=
getattr
(
self
.
_parent_block
,
attr
)
if
extend
:
if
extend
:
...
@@ -310,6 +313,8 @@ class Block(Base, Become, Conditional, Taggable):
...
@@ -310,6 +313,8 @@ class Block(Base, Become, Conditional, Taggable):
value
=
self
.
_extend_value
(
value
,
parent_value
)
value
=
self
.
_extend_value
(
value
,
parent_value
)
else
:
else
:
value
=
parent_value
value
=
parent_value
except
KeyError
:
pass
return
value
return
value
...
...
lib/ansible/playbook/task.py
View file @
6dd38c2a
...
@@ -363,7 +363,10 @@ class Task(Base, Conditional, Taggable, Become):
...
@@ -363,7 +363,10 @@ class Task(Base, Conditional, Taggable, Become):
'''
'''
Generic logic to get the attribute or parent attribute for a task value.
Generic logic to get the attribute or parent attribute for a task value.
'''
'''
value
=
None
try
:
value
=
self
.
_attributes
[
attr
]
value
=
self
.
_attributes
[
attr
]
if
self
.
_block
and
(
value
is
None
or
extend
):
if
self
.
_block
and
(
value
is
None
or
extend
):
parent_value
=
getattr
(
self
.
_block
,
attr
)
parent_value
=
getattr
(
self
.
_block
,
attr
)
if
extend
:
if
extend
:
...
@@ -376,6 +379,9 @@ class Task(Base, Conditional, Taggable, Become):
...
@@ -376,6 +379,9 @@ class Task(Base, Conditional, Taggable, Become):
value
=
self
.
_extend_value
(
value
,
parent_value
)
value
=
self
.
_extend_value
(
value
,
parent_value
)
else
:
else
:
value
=
parent_value
value
=
parent_value
except
KeyError
:
pass
return
value
return
value
def
_get_attr_environment
(
self
):
def
_get_attr_environment
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment