refactor: simplify sensor proxy installer argument detection by validating CTID and defaulting to standalone mode.

This commit is contained in:
courtmanr@gmail.com 2025-11-20 12:37:08 +00:00
parent 3f974c06ca
commit 6ca543beb6

View file

@ -4290,31 +4290,19 @@ if [ "$SKIP_TEMPERATURE_PROMPT" = true ]; then
# Live container detection succeeded # Live container detection succeeded
DETECTED_CTID="$PULSE_CTID" DETECTED_CTID="$PULSE_CTID"
elif [ -n "$SUMMARY_CTID" ]; then elif [ -n "$SUMMARY_CTID" ]; then
# Fall back to CTID from install_summary.json (container might be offline) # Verify the container actually exists before using the stale ID
if command -v pct >/dev/null 2>&1 && pct status "$SUMMARY_CTID" >/dev/null 2>&1; then
DETECTED_CTID="$SUMMARY_CTID" DETECTED_CTID="$SUMMARY_CTID"
fi fi
fi
if [ -n "$DETECTED_CTID" ]; then if [ -n "$DETECTED_CTID" ]; then
# Was deployed for containerized Pulse - use --ctid mode # Was deployed for containerized Pulse - use --ctid mode
INSTALLER_ARGS="--ctid $DETECTED_CTID --pulse-server $PULSE_URL" INSTALLER_ARGS="--ctid $DETECTED_CTID --pulse-server $PULSE_URL"
elif [ "$IS_STANDALONE_NODE" = true ]; then
# Standalone node - use --standalone --http-mode
INSTALLER_ARGS="--standalone --http-mode --pulse-server $PULSE_URL"
else else
# Cannot determine deployment type - bail out # Fallback to host-mode installation (works for standalone nodes and cluster nodes with external Pulse)
echo "" # We use --standalone flag to indicate host-level installation without container integration
echo "⚠️ Cannot determine proxy deployment type (no CTID, not standalone)" INSTALLER_ARGS="--standalone --http-mode --pulse-server $PULSE_URL"
echo " Manual repair required. Run one of:"
echo ""
echo " • For container:"
echo " curl -fsSL $PULSE_URL/api/install/install-sensor-proxy.sh | bash -s -- --ctid <CTID> --pulse-server $PULSE_URL"
echo ""
echo " • For standalone:"
echo " curl -fsSL $PULSE_URL/api/install/install-sensor-proxy.sh | bash -s -- --standalone --http-mode --pulse-server $PULSE_URL"
echo ""
echo " Keeping existing proxy configuration"
rm -f "$PROXY_INSTALLER"
INSTALLER_ARGS=""
fi fi
if [ -n "$INSTALLER_ARGS" ]; then if [ -n "$INSTALLER_ARGS" ]; then