Fix recreating cobbler entries on import#91
Fix recreating cobbler entries on import#91aaannz wants to merge 3 commits intouyuni-project:mainfrom
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.
| 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).
| @@ -0,0 +1,5 @@ | |||
| - Add missing name sanitizations for cobbler entries | |||
There was a problem hiding this comment.
Consider changing 'sanitizations' to 'sanitization' for more natural wording in the changelog entry.
| - Add missing name sanitizations for cobbler entries | |
| - Add missing name sanitization for cobbler entries |
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: