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
a02555ad
Commit
a02555ad
authored
Jul 07, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11483 from pilou-/jinja2_header_overrides
implement jinja2 header overrides
parents
2962047b
720e184f
Hide 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 @
a02555ad
...
...
@@ -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