-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Device un-racking #137
Device un-racking #137
Conversation
extras.status: 2 | ||
ipam.fhrpgroup: 1 | ||
tenancy.tenant: 11 | ||
tenancy.tenantgroup: 1 | ||
- Validation issues: ------------------------------------------------------------------------------- | ||
. dcim.device: 1 .................................................................................. | ||
4f3495b5-00e6-5917-a148-77e109f96b0f Half U Device | {'position': ['A U0 device type (Half U Device Type) cannot be assigned to a rack position.']} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the device can't be assigned to the rack, the validation issue is created, but the device is saved with the rack assignment now.
Does it makes sense to add --unrack-failing-devices
flag to nautobot-server import_netbox
management command to unrack these devices?
WDYT pls. @glennmatthews @chadell ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thought process is that if a Device can't be assigned to a rack (due to some validation), the importer should not rack it and log it. I don't understand "the device is saved with the rack assignment now". How is it possible if it fails?
I understand that unrack-failing-devices
should be the default option, and I don't see how it can be racked if it's not possible 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The record is saved using save()
so that it's imported in Nautobot. However, after each save()
there is another valided_save()
call. These calls gathers all records, that has been saved, however validation failed for those records.
In summary, there is a section listing all ValidationIssues
, that means, records are saved, however there is an issue with data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As same, as in previous version of NetBox importer, there is a switch --bypass-data-validation
in management command, that allows saving data to Nautobot, that fails validated_save()
call. When this switch is disabled, the importer fails if there are any ValidationIssues
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reformulating my question.
Current behavior:
There is a NetBox device with u_height = 0.5
, some rack
and position
assigned. When importing, u_height
is converted (truncated) to integer, so u_height = 0
. The device is saved using save()
, but the VaidationIssue
is created as it doesn't pass validated_save()
call. Device is assigned to the rack, but data are invalid. Device is NOT displayed in the Nautobot UI Non-Racked Devices
section.
Should I implement --unrack-failing-devices
flag to nautobot-server import_netbox
management command to un-rack these devices?
Un-racking means setting position = None
for these devices.
Pros:
- The device is displayed in the
Non-Racked Devices
section. - Device data are valid and can be updated.
validated_save()
call would pass.
Cons:
position
is lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I understand now. We offer the user a way to customize how to handle this situation that leads to a Device assigned to a rack but not visible in the non-racked Devices.
My question is with the invalid data (keeping the position but having no rack), is this useful for the user? I mean, if you can use the position with this u_height, why do we need to keep it? thus, I would make it the default behavior, and maybe add a flag to --do-not-unrack-failing-devices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented --no-unrack-zero-uheight-devices
to better describe what is this feature doing.
Blocked by: #139 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes: NaN
What's Changed