Skip to content

Query for advanced object selector does not use query_params defined on input #18727

@atownson

Description

@atownson

Deployment Type

NetBox Cloud

NetBox Version

v4.2.4

Python Version

3.12

Steps to Reproduce

Create two Sites and attempt to create a Virtual Machine scoped to conflicting Sites for fields site and cluster.

  1. Create 2 Sites: "My Site" and "Your Site"
  2. Create a Cluster Role: "My Role"
  3. Create a Cluster ("My Cluster") and assign it to "My Site"
  4. Create a Virtual Machine and assign it to "Your Site" and use the advanced object selector for the Cluster input to assign it to "My Cluster"

Expected Behavior

User should be unable to assign "My Cluster" because the Cluster is scoped to "My Site" and the Virtual Machine is scoped to "Your Site".

The query_params defined on the Virtual Machine's cluster input should prevent this:

query_params={
'site_id': ['$site', 'null']
},

Observed Behavior

While the cluster input itself does filter out the "My Cluster" option, selecting the Advanced Object Selector allows the selection of "My Cluster". Attempting to create the Virtual Machine scoped to the "My Cluster" Cluster returns an error:

Image

The scope of this issue is currently limited to form inputs that utilize both the selector=True and query_params={...} attributes. But with the acceptance of issues #18138 and #17944 this could be impactful to user-defined scripts and custom fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending closureRequires immediate attention to avoid being closed for inactivityseverity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions