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
a410bf26
Commit
a410bf26
authored
Sep 10, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap registered variables in UnsafeProxy
Fixes #12123
parent
46bf3d1b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
lib/ansible/plugins/strategies/__init__.py
+25
-0
No files found.
lib/ansible/plugins/strategies/__init__.py
View file @
a410bf26
...
...
@@ -35,6 +35,7 @@ from ansible.playbook.included_file import IncludedFile
from
ansible.playbook.role
import
hash_params
from
ansible.plugins
import
action_loader
,
connection_loader
,
filter_loader
,
lookup_loader
,
module_loader
from
ansible.template
import
Templar
from
ansible.vars.unsafe_proxy
import
UnsafeProxy
try
:
from
__main__
import
display
...
...
@@ -242,6 +243,30 @@ class StrategyBase:
host
=
result
[
1
]
var_name
=
result
[
2
]
var_value
=
result
[
3
]
def
_wrap_var
(
v
):
if
isinstance
(
v
,
dict
):
v
=
_wrap_dict
(
v
)
elif
isinstance
(
v
,
list
):
v
=
_wrap_list
(
v
)
else
:
if
v
is
not
None
and
not
isinstance
(
v
,
UnsafeProxy
):
v
=
UnsafeProxy
(
v
)
return
v
def
_wrap_dict
(
v
):
for
k
in
v
.
keys
():
if
v
[
k
]
is
not
None
and
not
isinstance
(
v
[
k
],
UnsafeProxy
):
v
[
k
]
=
_wrap_var
(
v
[
k
])
return
v
def
_wrap_list
(
v
):
for
idx
,
item
in
enumerate
(
v
):
if
item
is
not
None
and
not
isinstance
(
item
,
UnsafeProxy
):
v
[
idx
]
=
_wrap_var
(
item
)
return
v
var_value
=
_wrap_var
(
var_value
)
self
.
_variable_manager
.
set_host_facts
(
host
,
{
var_name
:
var_value
})
elif
result
[
0
]
in
(
'set_host_var'
,
'set_host_facts'
):
...
...
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