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

Config Render crashes netbox #18407

Open
ITTV-tools opened this issue Jan 16, 2025 · 2 comments
Open

Config Render crashes netbox #18407

ITTV-tools opened this issue Jan 16, 2025 · 2 comments
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: revisions needed This issue requires additional information to be actionable type: bug A confirmed report of unexpected behavior in the application

Comments

@ITTV-tools
Copy link

Deployment Type

Self-hosted

Triage priority

I volunteer to perform this work (if approved)

NetBox Version

4.2.1

Python Version

3.12

Steps to Reproduce

Create an device with an template

{% for interface in device.interfaces.all() %}
{%- if interface.mgmt_only == false %}
interface {{ interface.name }}
{%- if interface.description %}
description {{interface.description}}
{%- endif%}
{%- if interface.enabled == false %}
shutdown 
{%- elif interface.enabled == true %} 
no shutdown 
{%- endif%}
{%- if not interface.name.startswith('Vlan') %} 
{%- if interface.mode == "access" %}
switchport mode access
switchport nonegotiate
snmp trap mac-notification change added
snmp trap mac-notification change removed
{%- if device.dot1x %}
access-session control-direction in
access-session closed
access-session port-control auto
dot1x pae authenticator
service-policy type control subscriber POLICY_Access-Interfaces
{%- endif %}
{%- if interface.untagged_vlan %}
switchport access vlan {{ interface.untagged_vlan.vid }}
{%- endif %}
spanning-tree portfast
spanning-tree guard root
{%- elif interface.mode == "tagged" %} 
switchport mode trunk
switchport nonegotiate 
{%- if interface.untagged_vlan %}
switchport trunk nativ vlan {{ interface.untagged_vlan.vid }}
{%- endif %}
{%- for vlan in interface.tagged_vlans.all() %} 
switchport trunk allowed vlan add {{vlan.vid }} 
{%- endfor %} 
{%- elif "tagged-all" in interface.mode %}
{%- if "Access Point" in interface.tags.names() %}
snmp trap mac-notification change added
snmp trap mac-notification change removed
{%- endif %}
switchport mode trunk
switchport nonegotiate 
switchport trunk allowed vlan all
{%- if interface.untagged_vlan %}
switchport trunk nativ vlan {{ interface.untagged_vlan.vid }}
{%- endif %} 
{%- else %} 
{%-if interface.lag != None %} 
channel-group {% for char in interface.lag.name %}{%- if char.isdigit() %}{{ char }}{%- endif %}
{%-endfor %} mode on
{%- endif%} 
{%- endif %} 
{%- endif %}
{%- endif %} 
{%- if interface.ip_addresses.all() %}
{%- for ip in interface.ip_addresses.all() %}
ip address {{ ip.address.ip}} {{ ip.address.netmask }}
{%- endfor %}
 no ip route-cache
{%- endif %}
!
{%- endfor %}

Expected Behavior

Config should render, as it has in version: 4.1.7

Observed Behavior

Netbox crashes:

TypeError at /dcim/devices/55/render-config/

argument of type 'NoneType' is not iterable
Request Method: GET
http:///dcim/devices/55/render-config/
5.1.4
TypeError
argument of type 'NoneType' is not iterable
, line 226, in top-level template code dcim.views.DeviceRenderConfigView /opt/netbox/venv/bin/python 3.12.3 ['/opt/netbox/netbox/', '/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload', '/opt/netbox/venv/lib/python3.12/site-packages'] Thu, 16 Jan 2025 10:02:34 +0000
@ITTV-tools ITTV-tools added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Jan 16, 2025
@DanSheps
Copy link
Member

So it does appear the reverse manager is not being set. This is likely an undocumented upstream change but I am not 100% sure. Still looking into it.

@DanSheps DanSheps added status: under review Further discussion is needed to determine this issue's scope and/or implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Jan 16, 2025
@DanSheps DanSheps self-assigned this Jan 16, 2025
@jeremystretch
Copy link
Member

@ITTV-tools please reduce the example template to the minimum amount of logic required to reproduce the bug. This will ease troubleshooting efforts.

@jeremystretch jeremystretch added status: revisions needed This issue requires additional information to be actionable and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: revisions needed This issue requires additional information to be actionable type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

3 participants