Repository navigation
fix(image): wire up virt-ram-inherit and virt-file-size-inherit flags - #118
Merged
Merged
Conversation
image edit never registered these inherit flags (missing IsInheritable in their metadata) and, once registered, looked up the wrong flag name (copy-pasted from owners-inherit) when deciding whether to mark the field inherited. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
19 of 20 tasks
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.
Linked Items
No linked issue — found during an internal 4.0.0 release-readiness review, not filed as a GitHub issue.
Description
image edit --virt-ram-inheritand--virt-file-size-inheritwere both broken, for two separate reasons:cmd/metadata.go'simageIntFlagMetadata["virt-ram"]andimageFloatFlagMetadata["virt-file-size"]were missingIsInheritable: true(unlike the equivalentprofile/systemmetadata), soaddIntFlags/addFloatFlagsnever registered the--virt-ram-inherit/--virt-file-size-inheritflags onimage editat all — cobra rejected them withunknown flag.virt-ram-inherit/virt-file-size-inheritcases incmd/image.go'supdateImageFromFlagslooked upcmd.Flags().Lookup("owners-inherit")instead of their own flag name — an apparent copy-paste bug from theowners-inheritcase a few lines above — so the field was never actually marked inherited.Both defects had to be fixed together: fixing only the lookup name without also registering the flag would have caused
cmd.Flags().Lookup(...)to returnniland panic on.Changed.Developed test-first: added 4 regression tests to
cmd/image_test.goand confirmed each failure mode (unknown flag, then wrong lookup) before applying the corresponding fix.Behaviour changes
Old:
cobbler-cli image edit --virt-ram-inherit/--virt-file-size-inheriteither failed withunknown flagor silently left the field un-inherited.New: both flags are registered and correctly mark
Virt.Ram/Virt.FileSizeas inherited, matching the already-correct behavior of the equivalentprofile edit/system editflags.Category
This is related to a:
Tests