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
291f0724
Commit
291f0724
authored
Jul 15, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly return Jinja2 Undefined class for bad hostvars lookups
Fixes #11176
parent
9fe0f21f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
lib/ansible/vars/hostvars.py
+4
-0
No files found.
lib/ansible/vars/hostvars.py
View file @
291f0724
...
...
@@ -19,6 +19,8 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
from
jinja2
import
Undefined
as
j2undefined
from
ansible.template
import
Templar
__all__
=
[
'HostVars'
]
...
...
@@ -37,6 +39,8 @@ class HostVars(dict):
if
host_name
not
in
self
.
_lookup
:
host
=
self
.
_inventory
.
get_host
(
host_name
)
if
not
host
:
return
j2undefined
result
=
self
.
_vars_manager
.
get_vars
(
loader
=
self
.
_loader
,
play
=
self
.
_play
,
host
=
host
)
templar
=
Templar
(
variables
=
result
,
loader
=
self
.
_loader
)
self
.
_lookup
[
host_name
]
=
templar
.
template
(
result
,
fail_on_undefined
=
False
)
...
...
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