Added option to purge remaining devices #199
No reviewers
Labels
No labels
help wanted
need testing
status: accepted
status: discussing
type: bug
type: documentation
type: duplicate
type: enhancement
type:hardware
type: invalid
type: major feature
type: minor feature
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: DGNum/netbox-agent#199
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/chriss/purge_remaining_devices"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This patch adds an option to clear remaining devices in the context of a new device replacing an old one with the same name but with a different hardware.
The serial leading to the bug is described below:
A
with serialX
B
with serialY
X
is decomissionned, but not removedY
is reinstalled with nameA
In this case, a device with serial
X
is well found, and netbox agent tries to update its name. But this raises an error because of the unique constraint on name, as another device already holds this name.The proposed solution to handle this situation is to delete any device with same
name
but differentserial
before handling a device.As this is not necessarily the expected behavior, it can be enabled by using the
--purge-old-devices
to avoid breaking existing inventory.