fix(setup): properly reinstall sensor-proxy when socket exists (the real fix)
The previous attempt (ed04926) was ineffective - it only set TEMPERATURE_ENABLED=true
which was redundant (already set at line 4051) and didn't trigger the auto-install block
because that block is gated by SKIP_TEMPERATURE_PROMPT != true.
This fix actually downloads and runs install-sensor-proxy.sh when an existing
socket is detected, which:
- Refreshes control plane tokens (fixes 401 errors)
- Updates control plane URL to correct Pulse instance
- Rewrites config atomically (Phase 2 installer is idempotent)
- Maintains turnkey UX - rerunning setup script now actually works
Detected by Codex final review.
This commit is contained in:
parent
ed049263aa
commit
217ed67ee6
1 changed files with 44 additions and 3 deletions
|
|
@ -4289,9 +4289,50 @@ fi
|
|||
|
||||
# Single temperature monitoring prompt
|
||||
if [ "$SKIP_TEMPERATURE_PROMPT" = true ]; then
|
||||
echo "Existing pulse-sensor-proxy detected—running repair to refresh tokens and control-plane settings..."
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🔧 Refreshing pulse-sensor-proxy installation"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
TEMPERATURE_ENABLED=true
|
||||
echo "Existing proxy detected - updating to refresh tokens and control-plane settings..."
|
||||
echo ""
|
||||
|
||||
# Download and run installer to refresh config
|
||||
PROXY_INSTALLER="/tmp/install-sensor-proxy-repair-$$.sh"
|
||||
INSTALLER_URL="%s/api/install/install-sensor-proxy.sh"
|
||||
|
||||
if curl --fail --silent --location "$INSTALLER_URL" -o "$PROXY_INSTALLER" 2>/dev/null; then
|
||||
chmod +x "$PROXY_INSTALLER"
|
||||
|
||||
# Determine correct installer mode based on how it was originally deployed
|
||||
if [ "$PULSE_IS_CONTAINERIZED" = true ] && [ -n "$PULSE_CTID" ]; then
|
||||
# Was deployed for containerized Pulse - use --ctid mode
|
||||
"$PROXY_INSTALLER" --ctid "$PULSE_CTID" --pulse-server "%s"
|
||||
elif [ "$IS_STANDALONE_NODE" = true ]; then
|
||||
# Standalone node - use --standalone --http-mode
|
||||
"$PROXY_INSTALLER" --standalone --http-mode --pulse-server "%s"
|
||||
else
|
||||
# Clustered node without container - use default mode
|
||||
"$PROXY_INSTALLER" --pulse-server "%s"
|
||||
fi
|
||||
|
||||
REPAIR_STATUS=$?
|
||||
rm -f "$PROXY_INSTALLER"
|
||||
|
||||
if [ $REPAIR_STATUS -eq 0 ]; then
|
||||
echo ""
|
||||
echo "✓ pulse-sensor-proxy refreshed successfully"
|
||||
echo ""
|
||||
TEMPERATURE_ENABLED=true
|
||||
else
|
||||
echo ""
|
||||
echo "⚠️ Proxy repair had issues - check logs with: journalctl -u pulse-sensor-proxy -n 40"
|
||||
echo ""
|
||||
fi
|
||||
else
|
||||
echo "⚠️ Could not download installer from $INSTALLER_URL"
|
||||
echo " Keeping existing configuration"
|
||||
echo ""
|
||||
fi
|
||||
elif [ "$SSH_ALREADY_CONFIGURED" = true ]; then
|
||||
TEMPERATURE_ENABLED=true
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
|
@ -4926,7 +4967,7 @@ fi
|
|||
tokenName, tokenName, tokenName, tokenName, tokenName, tokenName,
|
||||
authToken, pulseURL, serverHost, tokenName, tokenName, storagePerms,
|
||||
sshKeys.ProxyPublicKey, sshKeys.SensorsPublicKey, minProxyReadyVersion,
|
||||
pulseURL, pulseURL, pulseURL, pulseURL, pulseURL, pulseURL, authToken, pulseURL, authToken, pulseURL, pulseURL, tokenName)
|
||||
pulseURL, pulseURL, pulseURL, pulseURL, pulseURL, pulseURL, authToken, pulseURL, authToken, pulseURL, pulseURL, pulseURL, pulseURL, pulseURL, pulseURL, tokenName)
|
||||
|
||||
} else { // PBS
|
||||
script = fmt.Sprintf(`#!/bin/bash
|
||||
|
|
|
|||
Loading…
Reference in a new issue