Skip to content

Jinja2 template fails to render when it contains include statements #19490

@mgades

Description

@mgades

Deployment Type

Self-hosted

NetBox Version

v.4.3.1

Python Version

3.10

Steps to Reproduce

  1. Create two Jinja2 template files ('router/main.j2' and 'common/base.j2'). Content could be empty or random text.
  2. Add a local Data Source (eg. named "netconfig") with the path from the above file locations.
  3. Add 'router/main.j2' as a Configuration Template and attach it to a device (eg. RTR1).
  4. In the 'router/main.j2' file add the following: {%- include 'common/base.j2' %}
  5. Sync the "netconfig" Data Source to update the changes in the file.
  6. Go the the RTR1 device and click the Render Config tab.

Expected Behavior

I would expect the content from 'common/base.j2' to be included in the output on the screen.

It worked fine in v4.2.8 (before upgrading to 4.3.0 and 4.3.1).

Observed Behavior

The complete exception is provided below:

<class 'TypeError'>

no loader for this environment specified

Python version: 3.10.12
NetBox version: 4.3.1
Plugins: None installed

Metadata

Metadata

Assignees

Labels

severity: mediumResults in substantial degraded or broken functionality for specfic workflowsstatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions