-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
NetBox version
v3.0.8
Python version
3.8
Steps to Reproduce
The following issue was completely reproduced in the netbox test environment (https://demo.netbox.dev/).
- Create a config context with some settings and assign it to any Site.
For example:{ "category": { "value 1": 10, "value 2": 20 } } - Look for a virtual machine, with a cluster matching the assigned Site and verify, that the config context gets correctly applied.
- Create an additional config context, with overlapping contents and apply it to any device type only.
For example:{ "category": { "value 2": 200, "value 3": 300, "value 4": 400 } } - Go back to the virtual machine you checked before and see, how the Rendered config context shows data which doesn't match the source contents.
Expected Behavior
The rendered config context should only contain the combined source contents, which match the given context. Especially a context, which is set to apply to a specific device type only should never appear in a virtual machine.
Observed Behavior
Values from the device type config context gets mixed into the rendered context, without even appearing in source context, and without matching:

There is an additional thing; I don't know if it is the same Bug, or another issue.
- Create an plain-text export template, which makes use of above config context:
{% for vm in queryset %}
NAME {{ vm.name }}
{% set data = vm.get_config_context().get("category",{}) %}
{% for key, value in data.items() %}
{{ key }} {{ value }}
{% endfor %}
{% endfor %}- Call this export (i.e.: https://demo.netbox.dev/virtualization/virtual-machines/?export=test )
- Call the export via api (i.e.: https://demo.netbox.dev/api/virtualization/virtual-machines/?export=test )
- Compare the two exports
What happens: The export, which is called without /api/ shows the values how they should be. When calling it via the /api/-Link, the same problem happens as above.
I would expect the export to always be the same, regardless of the way it is called.