Apply device specific config contexts from config context menu, not device #4314

Closed
opened 2025-12-29 18:34:41 +01:00 by adam · 3 comments
Owner

Originally created by @ledgley on GitHub (Nov 30, 2020).

  • Python version: 3.6.8
  • NetBox version: 2.9.10

Proposed Functionality

It could be seen as counter-intuitive to edit devices individually to assign local config contexts. It may be more appropriate to allow the assignment of config contexts to specific devices (or multiple specific devices) via the config context menu/form, by providing a form option for selecting devices or multiple devices.

Use Case

We have two more more devices that require the same config context, though there are additional devices, that meet all the same config context matching criteria, that do not require/should not have the config context. This means either
a. Configuring the same config context twice, on two+ local config contexts, posing risk for inconsistencies
b. Configuring a config context across a wider scope of devices that actually need it

It would be possible to do this with tags, though with many of the same scenario repeated, the tag scope becomes unwieldy.

Database Changes

Cannot answer this, as it is beyond my scope of knowledge.

External Dependencies

None

Originally created by @ledgley on GitHub (Nov 30, 2020). * Python version: 3.6.8 * NetBox version: 2.9.10 ### Proposed Functionality It could be seen as counter-intuitive to edit devices individually to assign local config contexts. It may be more appropriate to allow the assignment of config contexts to specific devices (or multiple specific devices) via the config context menu/form, by providing a form option for selecting devices or multiple devices. ### Use Case We have two more more devices that require the same config context, though there are additional devices, that meet all the same config context matching criteria, that do not require/should not have the config context. This means either a. Configuring the same config context twice, on two+ local config contexts, posing risk for inconsistencies b. Configuring a config context across a wider scope of devices that actually need it It would be possible to do this with tags, though with many of the same scenario repeated, the tag scope becomes unwieldy. ### Database Changes Cannot answer this, as it is beyond my scope of knowledge. ### External Dependencies None
adam added the pending closurestatus: under review labels 2025-12-29 18:34:41 +01:00
adam closed this issue 2025-12-29 18:34:41 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 30, 2020):

There are two problems with this. First, as soon as you begin to use the local_context_data field for non-unique data, you're inviting abuse and chaos. Attempting to determine what data is set on which devices individually is going to be much, much harder to keep up with than using the centralized ConfigContext model. (Indeed, this concern was the primary motivation for introducing the model to begin with.)

Second, you have the practical limitations. Suppose you have two devices, A and B, with the following local context data defined:

{
    "foo": 123
}
{
    "foo": 456
}

If I were to bulk edit these devices and specify {"bar": 789} as the local context data for both, how does NetBox know whether I want to append the new data or replace the existing data?

@jeremystretch commented on GitHub (Nov 30, 2020): There are two problems with this. First, as soon as you begin to use the `local_context_data` field for non-unique data, you're inviting abuse and chaos. Attempting to determine what data is set on which devices individually is going to be much, much harder to keep up with than using the centralized ConfigContext model. (Indeed, this concern was the primary motivation for introducing the model to begin with.) Second, you have the practical limitations. Suppose you have two devices, A and B, with the following local context data defined: ```json { "foo": 123 } ``` ```json { "foo": 456 } ``` If I were to bulk edit these devices and specify `{"bar": 789}` as the local context data for both, how does NetBox know whether I want to _append_ the new data or _replace_ the existing data?
Author
Owner

@stale[bot] commented on GitHub (Jan 17, 2021):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@stale[bot] commented on GitHub (Jan 17, 2021): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@stale[bot] commented on GitHub (Feb 2, 2021):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@stale[bot] commented on GitHub (Feb 2, 2021): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4314