Source Contexts missing on virtual machines #7681

Closed
opened 2025-12-29 20:26:56 +01:00 by adam · 8 comments
Owner

Originally created by @D1StrX on GitHub (Feb 26, 2023).

NetBox version

v3.4.5

Python version

3.8

Steps to Reproduce

(names and content don't matter)

  1. Create a site
  2. Create a virtual machine, and assign it to the created site
  3. Create a device, and assign it to the created site
  4. Create a config context, that applies to the created site (as long devices and virtual machines are targeted to compare the output)

Config context example:
Name: Network Config
Weight: 100
Description: Some description

{
    "name-servers": [
        "Example1",
        "Example2"
    ]
}
  • Is active
    Assignment
    Sites: Created site

Output should match something like this:
image

image

Expected Behavior

Virtual machines should also have the Source Contexts populated, like devices do.

Also the documentation doesn't mention/cover the Source Contexts: https://docs.netbox.dev/en/stable/features/context-data/

Observed Behavior

Both receive Rendered Contexts. Devices get their source contexts populated. Virtual machines don't.

Originally created by @D1StrX on GitHub (Feb 26, 2023). ### NetBox version v3.4.5 ### Python version 3.8 ### Steps to Reproduce (names and content don't matter) 1. Create a site 2. Create a virtual machine, and assign it to the created site 3. Create a device, and assign it to the created site 1. Create a config context, that applies to the created site (as long devices and virtual machines are targeted to compare the output) **Config context example:** Name: Network Config Weight: 100 Description: Some description ``` json { "name-servers": [ "Example1", "Example2" ] } ``` - Is active **Assignment** Sites: Created site Output should match something like this: ![image](https://user-images.githubusercontent.com/40062371/223462362-683e958a-5165-422a-8f18-41aaeed067d0.png) ![image](https://user-images.githubusercontent.com/40062371/223462741-352cba22-9658-4b8f-a50a-dec164a06cab.png) ### Expected Behavior Virtual machines should also have the _Source Contexts_ populated, like devices do. Also the documentation doesn't mention/cover the Source Contexts: https://docs.netbox.dev/en/stable/features/context-data/ ### Observed Behavior Both receive _Rendered Contexts_. Devices get their source contexts populated. Virtual machines don't.
adam added the type: bug label 2025-12-29 20:26:56 +01:00
adam closed this issue 2025-12-29 20:26:56 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (Feb 27, 2023):

Create a config context, that applies to a region e.g. (as long devices and virtual machines are targeted to compare the output)

Virtual machines do not have a region field, so I think you are misunderstanding something. I tested with Tenant and the config context rendered fine for both device and virtual machine. Please revise your replication steps.

@kkthxbye-code commented on GitHub (Feb 27, 2023): > Create a config context, that applies to a region e.g. (as long devices and virtual machines are targeted to compare the output) Virtual machines do not have a region field, so I think you are misunderstanding something. I tested with Tenant and the config context rendered fine for both device and virtual machine. Please revise your replication steps.
Author
Owner

@jeremystretch commented on GitHub (Mar 7, 2023):

Closing this as there's been no reply from OP.

@jeremystretch commented on GitHub (Mar 7, 2023): Closing this as there's been no reply from OP.
Author
Owner

@D1StrX commented on GitHub (Mar 7, 2023):

@kkthxbye-code @jeremystretch sorry for not getting back. Hereby some screenshots. First one is on the Virtual Machine, the other a Device. Both have rendered contexts, while only Device has a source context.
image

image

Assignment fields in Context:
image

@D1StrX commented on GitHub (Mar 7, 2023): @kkthxbye-code @jeremystretch sorry for not getting back. Hereby some screenshots. First one is on the Virtual Machine, the other a Device. Both have rendered contexts, while only Device has a source context. ![image](https://user-images.githubusercontent.com/40062371/223462362-683e958a-5165-422a-8f18-41aaeed067d0.png) ![image](https://user-images.githubusercontent.com/40062371/223462741-352cba22-9658-4b8f-a50a-dec164a06cab.png) Assignment fields in Context: ![image](https://user-images.githubusercontent.com/40062371/223463606-8b073987-69e8-4fc9-80b2-f9e31ca3d3b6.png)
Author
Owner

@kkthxbye-code commented on GitHub (Mar 11, 2023):

I still don't think this is enough for anyone to replicate it. Please make proper replication steps, which allows one to replicate it starting from an empty netbox instance.

@kkthxbye-code commented on GitHub (Mar 11, 2023): I still don't think this is enough for anyone to replicate it. Please make proper replication steps, which allows one to replicate it starting from an empty netbox instance.
Author
Owner

@D1StrX commented on GitHub (Mar 12, 2023):

Edited the replication steps. Hopefully this is enough information

@D1StrX commented on GitHub (Mar 12, 2023): Edited the replication steps. Hopefully this is enough information
Author
Owner

@jeremystretch commented on GitHub (Mar 13, 2023):

I'm still not able to reproduce this. Your screenshot shows far more objects than just site assigned to the ConfigContext object, which is likely where your problem lies.

@jeremystretch commented on GitHub (Mar 13, 2023): I'm still not able to reproduce this. Your screenshot shows far more objects than just site assigned to the ConfigContext object, which is likely where your problem lies.
Author
Owner

@D1StrX commented on GitHub (Mar 13, 2023):

I thought it shouldn't matter, because in the end the objects match all requirements. But I understand now, like kkthxbye-code said, Regions, Site Groups, Locations aren't available fields for VMs. Only odd thing is that the exact opposite happens when only assigning it to a Site (VM got source context instead of rendered context):
Config context:
image

Device:
image

VM:
image

What perhaps fixes my perception, and not yet explained in the documentation (what I could've find), what does the Source Contexts add as extra information to the Config Texts tab?
It is handy to have a clickable link to the config text.. but other than that?

@D1StrX commented on GitHub (Mar 13, 2023): I thought it shouldn't matter, because in the end the objects match all requirements. But I understand now, like kkthxbye-code said, Regions, Site Groups, Locations aren't available fields for VMs. Only odd thing is that the exact opposite happens when only assigning it to a Site (VM got source context instead of rendered context): Config context: ![image](https://user-images.githubusercontent.com/40062371/224838509-20cffb05-f32d-412e-8b4f-f39f2b64c08a.png) Device: ![image](https://user-images.githubusercontent.com/40062371/224838571-599551f5-dbca-4762-8f5e-a43295952a99.png) VM: ![image](https://user-images.githubusercontent.com/40062371/224838608-4b51e7a7-7aea-4e8e-afab-3be624f58a1e.png) What perhaps fixes my perception, and not yet explained in the documentation (what I could've find), what does the Source Contexts add as extra information to the Config Texts tab? It is handy to have a clickable link to the config text.. but other than that?
Author
Owner

@jeremystretch commented on GitHub (May 4, 2023):

Closing this out as no one has been able to replicate the described behavior and there have been no further updates. If anyone is able to reproduce the reported behavior on the current stable release of NetBox, please submit a new bug report with detailed, concise steps for doing so and we will investigate. Thanks.

@jeremystretch commented on GitHub (May 4, 2023): Closing this out as no one has been able to replicate the described behavior and there have been no further updates. If anyone _is_ able to reproduce the reported behavior on the current stable release of NetBox, please submit a new bug report with detailed, concise steps for doing so and we will investigate. Thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7681