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
720e184f
Commit
720e184f
authored
Jul 03, 2015
by
Pierre-Louis Bonicoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement jinja2 header overrides
parent
de98dc29
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
lib/ansible/template/__init__.py
+12
-0
No files found.
lib/ansible/template/__init__.py
View file @
720e184f
...
...
@@ -19,6 +19,7 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
import
ast
import
re
from
jinja2
import
Environment
...
...
@@ -256,6 +257,17 @@ class Templar:
overrides
=
JINJA2_ALLOWED_OVERRIDES
.
intersection
(
set
(
overrides
))
myenv
=
self
.
environment
.
overlay
(
overrides
)
# Get jinja env overrides from template
if
data
.
startswith
(
JINJA2_OVERRIDE
):
eol
=
data
.
find
(
'
\n
'
)
line
=
data
[
len
(
JINJA2_OVERRIDE
):
eol
]
data
=
data
[
eol
+
1
:]
for
pair
in
line
.
split
(
','
):
(
key
,
val
)
=
pair
.
split
(
':'
)
key
=
key
.
strip
()
if
key
in
JINJA2_ALLOWED_OVERRIDES
:
setattr
(
myenv
,
key
,
ast
.
literal_eval
(
val
.
strip
()))
#FIXME: add tests
myenv
.
filters
.
update
(
self
.
_get_filters
())
...
...
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