From 79e770a8fce003c2fda1147af7a5bbfc9dc6a600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jake=20Buchholz=20G=C3=B6kt=C3=BCrk?= Date: Mon, 25 Sep 2023 18:09:44 +0000 Subject: [PATCH] Fail on Init Action Failure * If an init action fails, tiny-cloud should terminate instead of proceeding. * Also, if bootstrap is incomplete, always re/load user-data, even if user-data file exists. --- CHANGELOG.md | 6 +++++- TODO.md | 7 ++++++- lib/tiny-cloud/init | 4 ---- sbin/tiny-cloud | 3 +++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1f5e47..f9e1305 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,13 @@ # CHANGELOG -## UNRELEASED - Tiny Cloud v3.0.x +## 2023-09-25 - Tiny Cloud v3.0.2 * Replace non-functioning `tiny-cloud --setup` with working `--enable` and `--disable` to enable/disable the set of Tiny Cloud init scripts. +* Reload user-data if bootstrap is incomplete, even if previous user-data file + exists. +* Init actions that fail sould cause the `tiny-cloud` to also terminate with an + error. ## 2023-06-12 - Tiny Cloud v3.0.1 diff --git a/TODO.md b/TODO.md index f921c69..7fa100e 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,11 @@ * Feature parity with current [amazon-ec2-net-utils]( https://github.com/amazonlinux/amazon-ec2-net-utils) * Support for non-AWS clouds - * daemonize to pick up IMDS network changes between reboots + * Daemonize to pick up IMDS network changes between reboots + * ***OR DEPRECATE AND NOT INSTALL FOR AWS BY DEFAULT*** + * `dhcpcd` seems to work just fine with multiple IPv6 delivered via DHCPv6 + * secondary IPv4 on an interface may be an edge case + * probably want to keep the `vnic-eth-hotplug` portion around for adding + and removing VNICs * Support LVM partitioning and non-`ext[234]` filesystems diff --git a/lib/tiny-cloud/init b/lib/tiny-cloud/init index 7685914..90770dc 100644 --- a/lib/tiny-cloud/init +++ b/lib/tiny-cloud/init @@ -200,10 +200,6 @@ init__enable_sshd() { init__save_userdata() { local userdata="$TINY_CLOUD_VAR/user-data" - if [ -f "$userdata" ]; then - log -i -t "$phase" info "$ACTION: user-data already saved" - return - fi local tmpfile=$(mktemp "$userdata.XXXXXX") imds -e @userdata > "$tmpfile" diff --git a/sbin/tiny-cloud b/sbin/tiny-cloud index 61107ff..089dad8 100755 --- a/sbin/tiny-cloud +++ b/sbin/tiny-cloud @@ -131,4 +131,7 @@ for ACTION in $INIT_ACTIONS; do fi printf ' ++ ' >&2 log -i -t "$phase" "$LEVEL" "$ACTION: $RESULT" + if [ "$RESULT" = "failed" ]; then + exit 1 + fi done