Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Jinja cached include #168

Merged
merged 3 commits into from
May 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -19,10 +19,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
)


def cnaas_init() -> Nornir:
Expand Down