Fix partial-width integration with Netbox-Utilities
The default mapping pointed to netbox_utilities.RackDevicePosition / width_fraction, which never existed, so partial widths were silently ignored: copying a rack lost them and deploying a concept with devices sharing a rack unit failed with "already occupied". Use netbox_utilities.DeviceRackPlacement (width, horizontal_position), convert between 0-based concept positions and the 1-based positions of netbox_utilities, and stage the width on the device before full_clean() so the Utilities collision check sees it. Configurations with the old model name are migrated automatically. Verified on NetBox 4.7.2: copying a rack with two half-width devices in one U and deploying it twice recreates both side by side. Bump version to 0.2.6. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9736a216be
commit
6ffe6348a6
6 files changed
+72
-17
No files matched your search
@@ -12,7 +12,7 @@ from dcim.models import Device, Rack
|
||||
|
||||
from . import components
|
||||
from .choices import ConceptDeviceStatusChoices, ConceptStatusChoices
|
||||
from .integrations import apply_partial_width, read_partial_width
|
||||
from .integrations import apply_partial_width, read_partial_width, stage_partial_width
|
||||
from .models import ConceptDeployment, ConceptDevice, RackConcept
|
||||
|
||||
__all__ = (
|
||||
@@ -452,6 +452,7 @@ def deploy_concept(concept, rack_names, site, location=None, tenant=None, create
|
||||
serial=planned_device.serial,
|
||||
description=planned_device.description,
|
||||
)
|
||||
stage_partial_width(device, planned_device)
|
||||
device.full_clean()
|
||||
device.save()
|
||||
apply_partial_width(device, planned_device)
|
||||
|
||||
Reference in new issue
Block a user