Skip to content

fix(image): wire up virt-ram-inherit and virt-file-size-inherit flags - #118

Merged
SchoolGuy merged 1 commit into
mainfrom
fix/image-virt-inherit-flags
Nov 17, 2026
Merged

SchoolGuy merged 1 commit into
mainfrom
fix/image-virt-inherit-flags

Conversation

@SchoolGuy

Copy link
Copy Markdown
Member

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-inherit and --virt-file-size-inherit were both broken, for two separate reasons:

  1. cmd/metadata.go's imageIntFlagMetadata["virt-ram"] and imageFloatFlagMetadata["virt-file-size"] were missing IsInheritable: true (unlike the equivalent profile/system metadata), so addIntFlags/addFloatFlags never registered the --virt-ram-inherit/--virt-file-size-inherit flags on image edit at all — cobra rejected them with unknown flag.
  2. Once registered, the virt-ram-inherit/virt-file-size-inherit cases in cmd/image.go's updateImageFromFlags looked up cmd.Flags().Lookup("owners-inherit") instead of their own flag name — an apparent copy-paste bug from the owners-inherit case 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 return nil and panic on .Changed.

Developed test-first: added 4 regression tests to cmd/image_test.go and 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-inherit either failed with unknown flag or silently left the field un-inherited.

New: both flags are registered and correctly mark Virt.Ram/Virt.FileSize as inherited, matching the already-correct behavior of the equivalent profile edit/system edit flags.

Category

This is related to a:

  • Bugfix
  • Feature
  • Packaging
  • Docs
  • Code Quality
  • Refactoring
  • Miscellaneous

Tests

  • Unit-Tests were created
  • System-Tests were created
  • Code is already covered by Unit-Tests
  • Code is already covered by System-Tests
  • No tests required

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>
@SchoolGuy SchoolGuy added this to the v1.0.0 milestone Nov 17, 2026
@github-project-automation github-project-automation Bot moved this to Pull Requests in Golang CLI Nov 17, 2026
@SchoolGuy
SchoolGuy merged commit cd27aed into main Nov 17, 2026
23 checks passed
@SchoolGuy
SchoolGuy deleted the fix/image-virt-inherit-flags branch November 17, 2026 13:45
@github-project-automation github-project-automation Bot moved this from Pull Requests to Done in Golang CLI Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant