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
a22f7b88
Commit
a22f7b88
authored
Sep 22, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restrict role param vars to tasks within that role
Fixes #12460
parent
ecf7d8c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
lib/ansible/playbook/role/__init__.py
+8
-6
lib/ansible/vars/__init__.py
+1
-1
No files found.
lib/ansible/playbook/role/__init__.py
View file @
a22f7b88
...
...
@@ -254,22 +254,24 @@ class Role(Base, Become, Conditional, Taggable):
default_vars
=
combine_vars
(
default_vars
,
self
.
_default_vars
)
return
default_vars
def
get_inherited_vars
(
self
,
dep_chain
=
[]):
def
get_inherited_vars
(
self
,
dep_chain
=
[]
,
include_params
=
True
):
inherited_vars
=
dict
()
for
parent
in
dep_chain
:
inherited_vars
=
combine_vars
(
inherited_vars
,
parent
.
_role_vars
)
inherited_vars
=
combine_vars
(
inherited_vars
,
parent
.
_role_params
)
if
include_params
:
inherited_vars
=
combine_vars
(
inherited_vars
,
parent
.
_role_params
)
return
inherited_vars
def
get_vars
(
self
,
dep_chain
=
[]):
all_vars
=
self
.
get_inherited_vars
(
dep_chain
)
def
get_vars
(
self
,
dep_chain
=
[]
,
include_params
=
True
):
all_vars
=
self
.
get_inherited_vars
(
dep_chain
,
include_params
=
include_params
)
for
dep
in
self
.
get_all_dependencies
():
all_vars
=
combine_vars
(
all_vars
,
dep
.
get_vars
())
all_vars
=
combine_vars
(
all_vars
,
dep
.
get_vars
(
include_params
=
include_params
))
all_vars
=
combine_vars
(
all_vars
,
self
.
_role_vars
)
all_vars
=
combine_vars
(
all_vars
,
self
.
_role_params
)
if
include_params
:
all_vars
=
combine_vars
(
all_vars
,
self
.
_role_params
)
return
all_vars
...
...
lib/ansible/vars/__init__.py
View file @
a22f7b88
...
...
@@ -256,7 +256,7 @@ class VariableManager:
if
not
C
.
DEFAULT_PRIVATE_ROLE_VARS
:
for
role
in
play
.
get_roles
():
all_vars
=
combine_vars
(
all_vars
,
role
.
get_vars
())
all_vars
=
combine_vars
(
all_vars
,
role
.
get_vars
(
include_params
=
False
))
if
task
:
if
task
.
_role
:
...
...
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