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
b61a7853
Commit
b61a7853
authored
Oct 20, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch template syntax errors specifically when templating strings
Fixes #9333
parent
b0069a33
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
2 deletions
+7
-2
lib/ansible/utils/template.py
+2
-0
test/integration/Makefile
+1
-0
test/integration/roles/test_bad_parsing/tasks/main.yml
+3
-1
test/integration/test_group_by.yml
+1
-1
No files found.
lib/ansible/utils/template.py
View file @
b61a7853
...
@@ -340,6 +340,8 @@ def template_from_string(basedir, data, vars, fail_on_undefined=False):
...
@@ -340,6 +340,8 @@ def template_from_string(basedir, data, vars, fail_on_undefined=False):
try
:
try
:
t
=
environment
.
from_string
(
data
)
t
=
environment
.
from_string
(
data
)
except
TemplateSyntaxError
,
e
:
raise
errors
.
AnsibleError
(
"template error while templating string:
%
s"
%
str
(
e
))
except
Exception
,
e
:
except
Exception
,
e
:
if
'recursion'
in
str
(
e
):
if
'recursion'
in
str
(
e
):
raise
errors
.
AnsibleError
(
"recursive loop detected in template string:
%
s"
%
data
)
raise
errors
.
AnsibleError
(
"recursive loop detected in template string:
%
s"
%
data
)
...
...
test/integration/Makefile
View file @
b61a7853
...
@@ -26,6 +26,7 @@ parsing:
...
@@ -26,6 +26,7 @@ parsing:
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
common,scenario2
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
common,scenario2
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
common,scenario3
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
common,scenario3
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
common,scenario4
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
common,scenario4
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
common,scenario5
;
[
$$
?
-eq
3
]
ansible-playbook good_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-v
$(TEST_FLAGS)
ansible-playbook good_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-v
$(TEST_FLAGS)
includes
:
includes
:
...
...
test/integration/roles/test_bad_parsing/tasks/main.yml
View file @
b61a7853
...
@@ -49,5 +49,7 @@
...
@@ -49,5 +49,7 @@
failed_when
:
False
failed_when
:
False
tags
:
scenario4
tags
:
scenario4
-
name
:
test that a missing/malformed jinja2 filter fails
debug
:
msg="{{output_dir|badfiltername}}"
tags
:
scenario5
test/integration/test_group_by.yml
View file @
b61a7853
...
@@ -92,7 +92,7 @@
...
@@ -92,7 +92,7 @@
-
name
:
set a fact to check that we ran this play
-
name
:
set a fact to check that we ran this play
set_fact
:
genus_LAMA=true
set_fact
:
genus_LAMA=true
-
hosts
:
'
{{
genus'
-
hosts
:
'
genus'
gather_facts
:
false
gather_facts
:
false
tasks
:
tasks
:
-
name
:
no hosts should match this group
-
name
:
no hosts should match this group
...
...
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