Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15fcos: print warning If Ignition is run more than once #1148

Merged
merged 1 commit into from
Aug 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions overlay.d/15fcos/usr/libexec/coreos-check-ignition-config
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ ignitionBoot=$(jq -r .provisioningBootID "${IGNITION_RESULT}")
if [ $(cat /proc/sys/kernel/random/boot_id) = "${ignitionBoot}" ]; then
echo "Ignition: ran on ${d} (this boot)" \
> /run/issue.d/30_coreos_ignition_provisioning.issue
sohankunkerkar marked this conversation as resolved.
Show resolved Hide resolved

# checking for /run/ostree-live as the live system with persistent storage can run Ignition more than once
if ! test -f /run/ostree-live && jq -e .previousReport.provisioningDate "${IGNITION_RESULT}" &>/dev/null; then
prevdate=$(date --date "$(jq -r .previousReport.provisioningDate "${IGNITION_RESULT}")" +"%Y/%m/%d %H:%M:%S %Z")
cat << EOF > /etc/issue.d/30_coreos_ignition_run_more_than_once.issue
${WARN}
############################################################################
WARNING: Ignition previously ran on ${prevdate}. Unexpected
behavior may occur. Ignition is not designed to run more than once per system.
############################################################################
${RESET}
EOF
fi
else
nreboots=$(($(journalctl --list-boots | wc -l) - 1))
[ "${nreboots}" -eq 1 ] && boot="boot" || boot="boots"
Expand Down