[PR #18375] [MERGED] Fixes: #18373 - Fix validation of site in Assign Device to Cluster flow #15337

Closed
opened 2025-12-30 00:21:21 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18375
Author: @bctiemann
Created: 1/10/2025
Status: Merged
Merged: 1/17/2025
Merged by: @jeremystretch

Base: mainHead: 18373-fix-assign-device-to-cluster-scope


📝 Commits (2)

  • 1fbfea5 Fix validation of site in Assign Device to Cluster flow
  • 30c4175 Validate Location as well as Site scope

📊 Changes

1 file changed (+20 additions, -12 deletions)

View changed files

📝 netbox/virtualization/forms/model_forms.py (+20 -12)

📄 Description

Fixes: #18373

Assigning a Device to a Cluster goes through a validation to ensure the Site of both objects is the same. Because Cluster is now generically scoped, this causes an error as Cluster.site no longer exists.

This change fixes the validation to compare Site objects properly, and also conforms to a pattern that can be extended to validate Location, Site Group, etc. scopes if they are added to the Assign Device form in the future.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/18375 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 1/10/2025 **Status:** ✅ Merged **Merged:** 1/17/2025 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `main` ← **Head:** `18373-fix-assign-device-to-cluster-scope` --- ### 📝 Commits (2) - [`1fbfea5`](https://github.com/netbox-community/netbox/commit/1fbfea56c12c0ab9315a9c70d17e873e83eb133e) Fix validation of site in Assign Device to Cluster flow - [`30c4175`](https://github.com/netbox-community/netbox/commit/30c41755aa641e9967ea177cc4e7ac2fa7d05765) Validate Location as well as Site scope ### 📊 Changes **1 file changed** (+20 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `netbox/virtualization/forms/model_forms.py` (+20 -12) </details> ### 📄 Description ### Fixes: #18373 Assigning a Device to a Cluster goes through a validation to ensure the Site of both objects is the same. Because Cluster is now generically scoped, this causes an error as `Cluster.site` no longer exists. This change fixes the validation to compare Site objects properly, and also conforms to a pattern that can be extended to validate Location, Site Group, etc. scopes if they are added to the Assign Device form in the future. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:21:21 +01:00
adam closed this issue 2025-12-30 00:21:21 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15337