1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #5665: Validate rack group is assigned to same site when creating a rack

This commit is contained in:
Jeremy Stretch
2021-01-25 14:19:32 -05:00
parent 08dfe64301
commit 87c600aa7c
2 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,7 @@
* [#5603](https://github.com/netbox-community/netbox/issues/5603) - Fix display of white cables in trace view * [#5603](https://github.com/netbox-community/netbox/issues/5603) - Fix display of white cables in trace view
* [#5639](https://github.com/netbox-community/netbox/issues/5639) - Fix filtering connection lists by device name * [#5639](https://github.com/netbox-community/netbox/issues/5639) - Fix filtering connection lists by device name
* [#5640](https://github.com/netbox-community/netbox/issues/5640) - Fix permissions assessment when adding VM interfaces in bulk * [#5640](https://github.com/netbox-community/netbox/issues/5640) - Fix permissions assessment when adding VM interfaces in bulk
* [#5665](https://github.com/netbox-community/netbox/issues/5665) - Validate rack group is assigned to same site when creating a rack
--- ---

View File

@ -299,6 +299,10 @@ class Rack(ChangeLoggedModel, CustomFieldModel):
def clean(self): def clean(self):
super().clean() super().clean()
# Validate group/site assignment
if self.site and self.group and self.group.site != self.site:
raise ValidationError(f"Assigned rack group must belong to parent site ({self.site}).")
# Validate outer dimensions and unit # Validate outer dimensions and unit
if (self.outer_width is not None or self.outer_depth is not None) and not self.outer_unit: if (self.outer_width is not None or self.outer_depth is not None) and not self.outer_unit:
raise ValidationError("Must specify a unit when setting an outer width/depth") raise ValidationError("Must specify a unit when setting an outer width/depth")