[3/3] fix(nautobot): round-trip location types by key and stop inventing locations - #258
Merged
jacobsalmela merged 1 commit intoOct 2, 2026
Conversation
…cations
Export creates Nautobot location types by the registered definition's
display name ("dc" becomes "Data Center"), but import stored the
reference URL of the Nautobot type in LocationType, so a re-imported
location carried "http://.../dcim/location-types/<uuid>/" instead of its
key and could not be resolved again on export.
Fetch location types during import and map each Nautobot type back to
the cani key through the registry (display name or slug, case-
insensitive), slugifying names cani has no definition for. Document the
display-name rule in the mapping guide.
Racks and devices with no resolvable location used to fall back to a
synthetic "Default" location that has no datastore counterpart; for
racks it was a Section-typed location Nautobot rejects for lacking a
parent, which failed the whole export. Both paths now fail with an
error naming the object and the remedies (a located rack or
--default-location) and never create a location the inventory does not
describe. Container-only types (dc, level) keep descending to a child
that holds racks, as before.
Unit tests cover the key resolution and the import of the type
reference; a new integration spec exports a dc > level > section tree,
re-imports it and reads the keys back, and proves a rack placed directly
under a dc location fails by name without a synthetic location.
Assisted-by: GitHub Copilot
Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com>
This was referenced Oct 2, 2026
jacobsalmela
added this pull request to stack #259
October 2, 2026 16:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dcbecomes "Data Center"); import previously stored the raw API URL in place of the key, so a re-imported datastore could not be exported again. Import now maps the Nautobot type back to the cani key, and the mapping guide documents the rule.make utestandmake ftestpass.Stack
Merge in order. Each PR targets the one before it, and GitHub retargets the next onto
mainas each merges.fix/export-module-interface-attributesmainfix/export-skipped-interface-accountingfix/export-module-interface-attributesfix/nautobot-location-type-roundtripfix/export-skipped-interface-accounting