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
922f6189
Commit
922f6189
authored
Oct 16, 2013
by
Tomaz Muraus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Throw a more user-friendly exception during template rendering process.
parent
807e6022
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
lib/ansible/utils/template.py
+9
-0
No files found.
lib/ansible/utils/template.py
View file @
922f6189
...
@@ -20,6 +20,7 @@ import re
...
@@ -20,6 +20,7 @@ import re
import
codecs
import
codecs
import
jinja2
import
jinja2
from
jinja2.runtime
import
StrictUndefined
from
jinja2.runtime
import
StrictUndefined
from
jinja2.exceptions
import
TemplateSyntaxError
import
yaml
import
yaml
import
json
import
json
from
ansible
import
errors
from
ansible
import
errors
...
@@ -448,7 +449,15 @@ def template_from_file(basedir, path, vars):
...
@@ -448,7 +449,15 @@ def template_from_file(basedir, path, vars):
setattr
(
environment
,
key
.
strip
(),
ast
.
literal_eval
(
val
.
strip
()))
setattr
(
environment
,
key
.
strip
(),
ast
.
literal_eval
(
val
.
strip
()))
environment
.
template_class
=
J2Template
environment
.
template_class
=
J2Template
try
:
t
=
environment
.
from_string
(
data
)
t
=
environment
.
from_string
(
data
)
except
TemplateSyntaxError
,
e
:
# Throw an exception which includes a more user friendly error message
values
=
{
'name'
:
realpath
,
'lineno'
:
e
.
lineno
,
'error'
:
str
(
e
)}
msg
=
'file:
%(name)
s, line number:
%(lineno)
s, error:
%(error)
s'
%
\
values
error
=
errors
.
AnsibleError
(
msg
)
raise
error
vars
=
vars
.
copy
()
vars
=
vars
.
copy
()
try
:
try
:
template_uid
=
pwd
.
getpwuid
(
os
.
stat
(
realpath
)
.
st_uid
)
.
pw_name
template_uid
=
pwd
.
getpwuid
(
os
.
stat
(
realpath
)
.
st_uid
)
.
pw_name
...
...
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