Skip to content

Commit

Permalink
Merge pull request #168 from SUNET/bugfix.jinja_cached_include
Browse files Browse the repository at this point in the history
Bugfix: Jinja cached include
  • Loading branch information
indy-independence authored May 19, 2021
2 parents ba2635a + 6580403 commit c906d0a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/cnaas_nms/confpush/nornir_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ class NornirJobResult(JobResult):
change_score: Optional[float] = None


cnaas_jinja_env = JinjaEnvironment(
class RelativeJinjaEnvironment(JinjaEnvironment):
"""Enable relative template paths"""
def join_path(self, template, parent):
return os.path.join(os.path.dirname(parent), template)


cnaas_jinja_env = RelativeJinjaEnvironment(
trim_blocks=True,
lstrip_blocks=True,
keep_trailing_newline=True)
keep_trailing_newline=True
)

cnaas_jinja_env.filters['increment_ip'] = jinja_filters.increment_ip
cnaas_jinja_env.filters['isofy_ipv4'] = jinja_filters.isofy_ipv4
Expand Down

0 comments on commit c906d0a

Please sign in to comment.