Skip to content

Identify devices/VMs with local config context set #7087

@candlerb

Description

@candlerb

NetBox version

v2.11.12

Feature type

Change to existing functionality

Proposed functionality

A way to identify those devices and VMs which have local config context data set. Options I can think of:

  1. In the device/VM listing, add "local_context_data" as a selectable column. However that's not great because it could contain a lot of data, although it could be truncated to the first N characters.
  2. In the device/VM listing, add a checkbox column which indicates if "local_context_data" is not empty, similar to "Assigned" on IP addresses; and/or
  3. In the device/VM listing, add a filter for devices with local_context_data set or not set

My preferred choice would be 3, or 2+3.

Use case

I needed to find which devices had local config context data set, and was unable to do so. They are not shown under /extras/config-contexts/ as those are only the configs which are assigned to groups.

I did wonder whether it would be possible to create a query by hand like /dcim/devices/?local_context_data__empty=0 but that doesn't appear to work, in either the GUI or the API.

In the end I was forced to do this via SQL queries:

select id,name,local_context_data from dcim_device where local_context_data is not null;
select id,name,local_context_data from virtualization_virtualmachine where local_context_data is not null;

(Aside: I also needed to remove the local_context_data from those devices, and ended up doing it one by one in the GUI as there's no option to do this on a selected subset using "Edit...". However this is a sufficiently rare requirement that this is reasonable)

Database changes

None

External dependencies

None

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions