Skip disks listed in DISK_DEVS that are not present on the machine - #66
Closed
nabeya11 wants to merge 2 commits into
Closed
Skip disks listed in DISK_DEVS that are not present on the machine#66nabeya11 wants to merge 2 commits into
nabeya11 wants to merge 2 commits into
Conversation
Anaconda raises KickstartParseError when a disk listed in "ignoredisk --only-use" or "clearpart --drives" does not exist, so a single DISK_DEVS value could not cover machines with different disk layouts. Build the two commands in %pre from the DISK_DEVS entries that actually exist and pull them in via %include, making DISK_DEVS a list of candidate disks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Kickstart generation flow so DISK_DEVS can be a candidate list: disks that don’t exist on the target machine are skipped in %pre, avoiding Anaconda/pykickstart parse failures when ignoredisk --only-use / clearpart --drives reference non-existent devices.
Changes:
- Generate
ignorediskandclearpartdirectives in%prebased on which/dev/<disk>entries fromDISK_DEVSactually exist, then pull them in via%include /tmp/ks.diskdevs.cfg. - Update documentation to clarify that
DISK_DEVSmay include disks that aren’t present and will be skipped.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| README.md | Clarifies DISK_DEVS semantics as a candidate list with skipping behavior. |
| ks.tpl.cfg | Replaces static ignoredisk/clearpart directives with a %pre-generated include file derived from present disks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
ks.tpl.cfg:63
@@DISK_DEVS@@is inserted into a shell command unquoted, so any characters like$(), backticks, or globs in the value would be evaluated by the shell during%pre. Even if this is usually admin-provided, quoting the template substitution avoids accidental breakage and removes an easy injection footgun.
for dev in $(echo @@DISK_DEVS@@ | tr "," " ")
ks.tpl.cfg:79
- When
diskdevsis empty, the generated include file containsignoredisk --only-use=/clearpart ... --drives=, which is invalid kickstart syntax and can fail parsing. It’s better to fail fast in%prewith a clear log message (and optionally validate thatMAIN_DISKis among the detected disks) rather than emitting invalid directives.
if [ -z "${diskdevs}" ]
then
echo "no disks in DISK_DEVS (@@DISK_DEVS@@) found"
fi
cat > /tmp/ks.diskdevs.cfg <<EOF
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.
Anaconda aborts with KickstartParseError when a disk listed in
ignoredisk --only-useorclearpart --drivesdoes not exist, so one DISK_DEVS value could not cover machines with different disk layouts.Generate the two commands in %pre from the DISK_DEVS entries that actually exist and pull them in via
%include, making DISK_DEVS a candidate list. Skipped disks are logged to ks-pre.log.No behavior change when all listed disks exist: the generated commands are identical to the previous static ones.
c.f. https://pykickstart.readthedocs.io/en/latest/kickstart-examples.html