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:
@@ -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