Skip to content

Skip disks listed in DISK_DEVS that are not present on the machine - #66

Closed
nabeya11 wants to merge 2 commits into
mainfrom
diskdevs-existing-only
Closed

Skip disks listed in DISK_DEVS that are not present on the machine#66
nabeya11 wants to merge 2 commits into
mainfrom
diskdevs-existing-only

Conversation

@nabeya11

Copy link
Copy Markdown
Member

Anaconda aborts with KickstartParseError when a disk listed in ignoredisk --only-use or clearpart --drives does 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

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ignoredisk and clearpart directives in %pre based on which /dev/<disk> entries from DISK_DEVS actually exist, then pull them in via %include /tmp/ks.diskdevs.cfg.
  • Update documentation to clarify that DISK_DEVS may 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.

Comment thread ks.tpl.cfg
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 diskdevs is empty, the generated include file contains ignoredisk --only-use= / clearpart ... --drives=, which is invalid kickstart syntax and can fail parsing. It’s better to fail fast in %pre with a clear log message (and optionally validate that MAIN_DISK is 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

@nabeya11
nabeya11 requested a review from at-wat July 29, 2026 08:31
@nabeya11
nabeya11 marked this pull request as ready for review July 29, 2026 08:32
@nabeya11 nabeya11 closed this Jul 30, 2026
@nabeya11
nabeya11 deleted the diskdevs-existing-only branch July 30, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants