Fix recreating cobbler entries on import#91
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes Cobber entry naming sanitization to avoid unnecessary recreation on import, and skips distro profile refresh when there are no images to process.
Changes:
- Add name/org sanitization for Cobbler entry naming helpers.
- Skip
updateDistroProfileswork when the image list is empty. - Add unit tests for Cobbler name construction.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| inter-server-sync.changes.oholecek.fix_cobbler_imports | Changelog entry describing the import/sanitization fixes |
| cobbler/cobbler_test.go | Adds unit tests covering Cobbler naming helpers and sanitization |
| cobbler/cobbler.go | Implements sanitization helpers and early-return behavior for empty image input |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+282
to
+285
| if len(images) == 0 { | ||
| log.Debug().Msg("No image to process, skipping") | ||
| return nil | ||
| } |
There was a problem hiding this comment.
New behavior was added to updateDistroProfiles (early return when images is empty), but there’s no corresponding unit test validating it. Add a test that calls updateDistroProfiles([]Image{}) and asserts it returns nil and does not attempt any external calls (e.g., via the test hook used for command execution in this package).
ae9fb94 to
21a7bd4
Compare
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.
This PR add missing removal and translation of the invalid characters to properly sanitize cobbler entries naming.
Import now skips recreating distro profiles if there is no image present at all.
Issues: