From 87e206de3924b0925c4591dfbc131f704aaeeff2 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Sat, 11 Apr 2026 14:11:50 +0300 Subject: [PATCH] fix(hack): symmetrize runtime checks and soften HINT text Two small issues caught in review: 1. check_containerd probed the socket unconditionally even when service_active had already set found=1, while check_docker short circuited the same path behind 'if \[ $found -eq 0 \]'. The asymmetry was not user visible but violated least surprise for future maintainers. check_containerd now uses the same gated pattern. 2. The HINT block recommended 'sudo rm -rf /var/lib/docker /var/lib/containerd' as a casual follow up, which could destroy data the operator still needs. Replace that line with a warning telling the operator to inspect and reclaim standalone runtime storage manually rather than deleting it blindly. Also drop a no op 'printf' from disk_usage that served no purpose. Assisted-By: Claude Signed-off-by: Aleksei Sviridkin --- hack/check-host-runtime.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hack/check-host-runtime.sh b/hack/check-host-runtime.sh index a3ec6f2d3..974013910 100755 --- a/hack/check-host-runtime.sh +++ b/hack/check-host-runtime.sh @@ -60,10 +60,8 @@ disk_usage() { usage=$(du -sh "$path" 2>/dev/null | awk '{print $1}' || true) if [ -n "${usage:-}" ]; then printf ' (%s uses %s)' "$path" "$usage" - return 0 fi fi - printf '' } service_active() { @@ -82,7 +80,7 @@ check_containerd() { if service_active containerd.service; then found=1 fi - if [ -e "$CONTAINERD_SOCKET" ]; then + if [ "$found" -eq 0 ] && [ -e "$CONTAINERD_SOCKET" ]; then found=1 fi if [ "$found" -eq 1 ]; then @@ -123,7 +121,8 @@ check_docker if [ "$WARNINGS" -gt 0 ]; then printf '%bHINT:%b cozystack runs its own containerd under k3s. To stop the shadow runtime:\n' "$YELLOW" "$RESET" >&2 printf ' sudo systemctl disable --now docker.service containerd.service\n' >&2 - printf ' sudo rm -rf /var/lib/docker /var/lib/containerd\n' >&2 + printf 'Inspect and reclaim standalone runtime storage separately — it may contain container data\n' >&2 + printf 'that the operator still needs; do not delete it blindly.\n' >&2 fi exit 0