Prevent ignition from running twice in a provision-to-disk configuration
Ignition runs during provision-to-disk, and then also tries to run again during sytsemd. This commit adds a sentinel file during the initial provision-to-disk that is detected by systemd to prevent re-running ignition partitioning / formatting. - Fixes: #1981 Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -46,6 +46,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Fix warewulf-dracut to not run the wwinit module if root is not set to `root=wwclient*`
|
||||
- Fix `wwctl image import --update` #2066
|
||||
- Fix filesystem overwrite/force behavior in mkfs overlay. #2028
|
||||
- Prevent ignition from running twice in a provision-to-disk configuration. #1981
|
||||
|
||||
### Dependencies
|
||||
|
||||
|
||||
@@ -46,3 +46,11 @@ info "warewulf: mounting ${wwinit_root_device} at ${NEWROOT}"
|
||||
for stage in "image" "system" "runtime"; do
|
||||
get_stage "${stage}"
|
||||
done
|
||||
|
||||
# Copy /warewulf/run from initramfs to NEWROOT
|
||||
# This preserves state files created by wwinit.d scripts (e.g., ignition marker)
|
||||
if [ -d /tmp/wwinit/warewulf/run ]; then
|
||||
info "warewulf: preserving /warewulf/run to mounted root"
|
||||
mkdir -p "${NEWROOT}/warewulf"
|
||||
cp -a /tmp/wwinit/warewulf/run "${NEWROOT}/warewulf/"
|
||||
fi
|
||||
|
||||
@@ -3,10 +3,9 @@ Description=Ignition warewulf (disks)
|
||||
Documentation=https://warewulf.org/
|
||||
ConditionPathExists=/warewulf/ignition.json
|
||||
ConditionPathExists=/usr/lib/dracut/modules.d/30ignition/ignition
|
||||
ConditionPathExists=!/warewulf/run/.ignition-done
|
||||
DefaultDependencies=false
|
||||
|
||||
Before=ignition-ww4-mount.service
|
||||
|
||||
# This stage runs between `basic.target` and `initrd-root-device.target`,
|
||||
# see https://www.freedesktop.org/software/systemd/man/bootup.html
|
||||
# Make sure to run before the file system checks, as sgdisk will trigger
|
||||
|
||||
@@ -17,7 +17,14 @@ fi
|
||||
|
||||
if command -v ignition >/dev/null; then :
|
||||
info "warewulf: ignition: partition and format disks"
|
||||
ignition --config-cache="${PREFIX}/warewulf/ignition.json" --platform=metal --stage=disks || die "warewulf: ignition: failed to partition/format disk"
|
||||
if ignition --config-cache="${PREFIX}/warewulf/ignition.json" --platform=metal --stage=disks; then
|
||||
# Create marker file to signal successful completion
|
||||
# This prevents the systemd service from running ignition again after switch_root
|
||||
mkdir -p "${PREFIX}/warewulf/run"
|
||||
echo "ignition run by 10-ignition.sh" >"${PREFIX}/warewulf/run/.ignition-done"
|
||||
else
|
||||
die "warewulf: ignition: failed to partition/format disk"
|
||||
fi
|
||||
else
|
||||
info "warewulf: ignition not found"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user