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
84b8a80a
Commit
84b8a80a
authored
Mar 31, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted error on play var initialization into warning with more information
parent
1d4b9647
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
lib/ansible/playbook/play.py
+5
-1
lib/ansible/utils/template.py
+5
-6
No files found.
lib/ansible/playbook/play.py
View file @
84b8a80a
...
@@ -119,7 +119,11 @@ class Play(object):
...
@@ -119,7 +119,11 @@ class Play(object):
temp_vars
=
utils
.
combine_vars
(
self
.
vars
,
self
.
vars_file_vars
)
temp_vars
=
utils
.
combine_vars
(
self
.
vars
,
self
.
vars_file_vars
)
temp_vars
=
utils
.
combine_vars
(
temp_vars
,
self
.
playbook
.
extra_vars
)
temp_vars
=
utils
.
combine_vars
(
temp_vars
,
self
.
playbook
.
extra_vars
)
ds
=
template
(
basedir
,
ds
,
temp_vars
)
try
:
ds
=
template
(
basedir
,
ds
,
temp_vars
)
except
errors
.
AnsibleError
,
e
:
utils
.
warning
(
"non fatal error while trying to template play variables:
%
s"
%
(
str
(
e
)))
ds
[
'tasks'
]
=
_tasks
ds
[
'tasks'
]
=
_tasks
ds
[
'handlers'
]
=
_handlers
ds
[
'handlers'
]
=
_handlers
...
...
lib/ansible/utils/template.py
View file @
84b8a80a
...
@@ -118,7 +118,10 @@ def template(basedir, varname, templatevars, lookup_fatal=True, depth=0, expand_
...
@@ -118,7 +118,10 @@ def template(basedir, varname, templatevars, lookup_fatal=True, depth=0, expand_
if
isinstance
(
varname
,
basestring
):
if
isinstance
(
varname
,
basestring
):
if
'{{'
in
varname
or
'{
%
'
in
varname
:
if
'{{'
in
varname
or
'{
%
'
in
varname
:
varname
=
template_from_string
(
basedir
,
varname
,
templatevars
,
fail_on_undefined
)
try
:
varname
=
template_from_string
(
basedir
,
varname
,
templatevars
,
fail_on_undefined
)
except
errors
.
AnsibleError
,
e
:
raise
errors
.
AnsibleError
(
"Failed to template
%
s:
%
s"
%
(
varname
,
str
(
e
)))
if
(
varname
.
startswith
(
"{"
)
and
not
varname
.
startswith
(
"{{"
))
or
varname
.
startswith
(
"["
):
if
(
varname
.
startswith
(
"{"
)
and
not
varname
.
startswith
(
"{{"
))
or
varname
.
startswith
(
"["
):
eval_results
=
utils
.
safe_eval
(
varname
,
locals
=
templatevars
,
include_exceptions
=
True
)
eval_results
=
utils
.
safe_eval
(
varname
,
locals
=
templatevars
,
include_exceptions
=
True
)
...
@@ -188,11 +191,7 @@ class _jinja2_vars(object):
...
@@ -188,11 +191,7 @@ class _jinja2_vars(object):
if
isinstance
(
var
,
dict
)
and
varname
==
"vars"
or
isinstance
(
var
,
HostVars
):
if
isinstance
(
var
,
dict
)
and
varname
==
"vars"
or
isinstance
(
var
,
HostVars
):
return
var
return
var
else
:
else
:
try
:
return
template
(
self
.
basedir
,
var
,
self
.
vars
,
fail_on_undefined
=
self
.
fail_on_undefined
)
return
template
(
self
.
basedir
,
var
,
self
.
vars
,
fail_on_undefined
=
self
.
fail_on_undefined
)
except
:
raise
KeyError
(
"undefined variable:
%
s"
%
varname
)
def
add_locals
(
self
,
locals
):
def
add_locals
(
self
,
locals
):
'''
'''
...
...
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