1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #12115: Fix rendering config templates from a data file

This commit is contained in:
jeremystretch
2023-03-31 10:37:12 -04:00
parent bd38b50e5e
commit 6a85c5b3ce
2 changed files with 5 additions and 1 deletions

View File

@@ -245,7 +245,10 @@ class ConfigTemplate(SyncedDataMixin, ExportTemplatesMixin, TagsMixin, ChangeLog
# Initialize the Jinja2 environment and instantiate the Template
environment = self._get_environment()
template = environment.from_string(self.template_code)
if self.data_file:
template = environment.get_template(self.data_file.path)
else:
template = environment.from_string(self.template_code)
output = template.render(**context)
# Replace CRLF-style line terminators