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
6e84374c
Commit
6e84374c
authored
Jul 20, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make hostvars work post refactoring
parent
b0eedfbf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
12 deletions
+5
-12
lib/ansible/runner/__init__.py
+4
-1
lib/ansible/utils.py
+1
-11
No files found.
lib/ansible/runner/__init__.py
View file @
6e84374c
...
...
@@ -552,9 +552,11 @@ class Runner(object):
host_variables
=
self
.
inventory
.
get_variables
(
host
)
port
=
host_variables
.
get
(
'ansible_ssh_port'
,
self
.
remote_port
)
inject
=
self
.
setup_cache
[
host
]
.
copy
()
inject
[
'hostvars'
]
=
self
.
setup_cache
inject
.
update
(
host_variables
)
inject
.
update
(
self
.
module_vars
)
items
=
self
.
module_vars
.
get
(
'items'
,
[])
if
isinstance
(
items
,
basestring
)
and
items
.
startswith
(
"$"
):
items
=
items
.
replace
(
"$"
,
""
)
...
...
@@ -646,7 +648,8 @@ class Runner(object):
self
.
callbacks
.
on_unreachable
(
host
,
result
.
result
)
else
:
data
=
result
.
result
result
.
result
[
'item'
]
=
inject
.
get
(
'item'
,
None
)
if
'item'
in
inject
:
result
.
result
[
'item'
]
=
inject
[
'item'
]
if
'skipped'
in
data
:
self
.
callbacks
.
on_skipped
(
result
.
host
)
elif
not
result
.
is_successful
():
...
...
lib/ansible/utils.py
View file @
6e84374c
...
...
@@ -192,16 +192,6 @@ def varReplace(raw, vars):
return
''
.
join
(
done
)
def
_template
(
text
,
vars
):
''' run a text buffer through the templating engine '''
if
vars
is
None
:
raise
Exception
(
'vars is none'
)
vars
=
vars
.
copy
()
# FIXME: do this in runner code
vars
[
'hostvars'
]
=
vars
.
get
(
'setup_cache'
,
{})
return
varReplace
(
unicode
(
text
),
vars
)
def
template
(
text
,
vars
):
''' run a text buffer through the templating engine until it no longer changes '''
...
...
@@ -212,7 +202,7 @@ def template(text, vars):
if
(
depth
>
20
):
raise
errors
.
AnsibleError
(
"template recursion depth exceeded"
)
prev_text
=
text
text
=
_template
(
text
,
vars
)
text
=
varReplace
(
unicode
(
text
)
,
vars
)
return
text
def
template_from_file
(
basedir
,
path
,
vars
):
...
...
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