Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Point the exec rejection message at a fresh commands-enabled install

rcourtman8e1d5729d402
diff --git a/internal/agentexec/server.go b/internal/agentexec/server.go
index 714c751c82..05167869d9 100644
--- a/internal/agentexec/server.go
+++ b/internal/agentexec/server.go
@@ -731,7 +731,7 @@ func (s *Server) HandleWebSocket(w http.ResponseWriter, r *http.Request) {
// bound to this agent) are both fixed by re-enrolling, while a token
// that exists but lacks the scope is named explicitly. Avoids the silent
// retry loop that previously gave operators nothing to act on.
- rejectedMsg, err := NewMessage(MsgTypeRegistered, "", RegisteredPayload{Success: false, Message: "agent token not authorized for command execution — re-run the agent installer to enroll an agent:exec-scoped token"})
+ rejectedMsg, err := NewMessage(MsgTypeRegistered, "", RegisteredPayload{Success: false, Message: "agent token not authorized for command execution — generate a fresh install command with commands enabled (Settings > Infrastructure > Add Pulse Agent) and re-run it on this host; the existing token cannot be upgraded in place"})
if err != nil {
log.Warn().Err(err).Str("agent_id", reg.AgentID).Msg("Failed to encode rejection message")
conn.Close()
diff --git a/internal/agentexec/server_coverage_test.go b/internal/agentexec/server_coverage_test.go
index e4e27f9277..5f60b36939 100644
--- a/internal/agentexec/server_coverage_test.go
+++ b/internal/agentexec/server_coverage_test.go
@@ -201,7 +201,7 @@ func TestHandleWebSocket_RejectionMessageIsActionable(t *testing.T) {
if payload.Message == "Invalid token" {
t.Fatalf("rejection message must not be the bare opaque 'Invalid token'")
}
- if !strings.Contains(payload.Message, "re-run the agent installer") {
+ if !strings.Contains(payload.Message, "generate a fresh install command with commands enabled") {
t.Fatalf("rejection message should point the operator at re-enrollment, got: %q", payload.Message)
}
}