Skip to content

Commit 958c634

Browse files
Dobbyclaude
andcommitted
fix: waagent status quoting bug + realign [4/5] output
- WAAGENT_STATUS now captures single-line output; doesn't double up when walinuxagent is masked (inactive + exit code 3) - Step [4/5] sub-check values now appear on their own indented line so longer "PrivateClaw Gateway:" label doesn't push everything right Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7fdf02f commit 958c634

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

privateclaw

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ cmd_verify() {
377377
OC_CONFIG="$ADMIN_HOME/.openclaw/openclaw.json"
378378
if [ ! -f "$OC_CONFIG" ]; then
379379
[ "$VERBOSE" = "true" ] && echo " Config: not found at $OC_CONFIG"
380-
echo " Status: FAIL"
380+
echo " Status: FAIL"
381381
FAIL_COUNT=$((FAIL_COUNT + 1))
382382
echo ""
383383
else
@@ -630,7 +630,7 @@ PYEOF
630630
# headers. Treat as FAIL with no sub-checks.
631631
if [ -z "$UPSTREAM_LABEL" ] && [ -z "$GATEWAY_DETAIL" ] && [ -z "$INF_HEADERS" ]; then
632632
[ "$VERBOSE" = "true" ] && echo " Connection: could not reach inference endpoint"
633-
echo " Status: FAIL"
633+
echo " Status: FAIL"
634634
FAIL_COUNT=$((FAIL_COUNT + 1))
635635
echo ""
636636
else
@@ -642,20 +642,28 @@ PYEOF
642642
UPSTREAM_LABEL="Confidential AI:"
643643
UPSTREAM_DETAIL="Verification failed"
644644
fi
645-
printf " %-21s %s\n" "$UPSTREAM_LABEL" "$UPSTREAM_DETAIL"
646-
printf " %-21s %s\n" "PrivateClaw Gateway:" "$GATEWAY_DETAIL"
645+
# Label on its own line; value indented to column 15 on the next line.
646+
# This keeps long upstream labels (e.g. "Redpill (failover):") and long
647+
# detail strings from colliding, and stays readable in narrow terminals.
648+
printf " %s\n" "$UPSTREAM_LABEL"
649+
printf " %s\n" "$UPSTREAM_DETAIL"
650+
printf " %s\n" "PrivateClaw Gateway:"
651+
printf " %s\n" "$GATEWAY_DETAIL"
647652

648653
# --- Roll up Status ---
654+
# Status stays on a single line (matches other steps), but uses a
655+
# narrower label width than the other checks so the sub-check values
656+
# above (indented to col 15) line up visually with the Status value.
649657
if [ "$UPSTREAM_OK" = "true" ] && [ "$GATEWAY_OK" = "true" ]; then
650658
if [ "$FAILOVER_ACTIVE" = "true" ]; then
651-
echo " Status: WARN (Redpill failover active)"
659+
echo " Status: WARN (Redpill failover active)"
652660
FAIL_COUNT=$((FAIL_COUNT + 1))
653661
else
654-
echo " Status: PASS"
662+
echo " Status: PASS"
655663
PASS_COUNT=$((PASS_COUNT + 1))
656664
fi
657665
else
658-
echo " Status: FAIL"
666+
echo " Status: FAIL"
659667
FAIL_COUNT=$((FAIL_COUNT + 1))
660668
fi
661669
echo ""
@@ -678,7 +686,15 @@ PYEOF
678686

679687
# Check if Azure Guest Agent can receive extensions
680688
# Method 1: Check walinuxagent service status
681-
WAAGENT_STATUS=$(systemctl is-active walinuxagent 2>/dev/null || echo "inactive")
689+
#
690+
# NOTE: `systemctl is-active` prints its verdict AND exits non-zero for any
691+
# non-active state (e.g. "inactive" -> exit 3, "masked" -> exit 3). Using
692+
# `|| echo "inactive"` then APPENDS a second "inactive" onto stdout, and
693+
# the resulting "inactive\ninactive" string never equals "inactive" in the
694+
# comparison below. Capture stdout unconditionally, trim, default to
695+
# "inactive" if empty.
696+
WAAGENT_STATUS=$(systemctl is-active walinuxagent 2>/dev/null | head -1 | tr -d '[:space:]')
697+
[ -z "$WAAGENT_STATUS" ] && WAAGENT_STATUS="inactive"
682698
# Method 2: Check waagent.conf Extensions.Enabled setting
683699
EXTENSIONS_CONF=$(grep -i "^Extensions.Enabled" /etc/waagent.conf 2>/dev/null | cut -d= -f2 | tr -d ' ' || echo "unknown")
684700

0 commit comments

Comments
 (0)