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.

Fix agent download serving wrong architecture binary

rcourtmanc4b893e25761
diff --git a/internal/api/unified_agent.go b/internal/api/unified_agent.go
index 8e2e7d9120..43be9d5d64 100644
--- a/internal/api/unified_agent.go
+++ b/internal/api/unified_agent.go
@@ -109,23 +109,26 @@ func (r *Router) handleDownloadUnifiedAgent(w http.ResponseWriter, req *http.Req
archParam := strings.TrimSpace(req.URL.Query().Get("arch"))
searchPaths := make([]string, 0, 6)
- if normalized := normalizeUnifiedAgentArch(archParam); normalized != "" {
+ // If a specific architecture is requested, only look for that architecture
+ // Do NOT fall back to generic binary - that could serve the wrong architecture
+ normalized := normalizeUnifiedAgentArch(archParam)
+ if normalized != "" {
searchPaths = append(searchPaths,
filepath.Join(pulseBinDir(), "pulse-agent-"+normalized),
filepath.Join("/opt/pulse", "pulse-agent-"+normalized),
filepath.Join("/app", "pulse-agent-"+normalized),
filepath.Join(r.projectRoot, "bin", "pulse-agent-"+normalized),
)
+ } else {
+ // No specific architecture requested - allow fallback to generic binary
+ searchPaths = append(searchPaths,
+ filepath.Join(pulseBinDir(), "pulse-agent"),
+ "/opt/pulse/pulse-agent",
+ filepath.Join("/app", "pulse-agent"),
+ filepath.Join(r.projectRoot, "bin", "pulse-agent"),
+ )
}
- // Default locations (host architecture)
- searchPaths = append(searchPaths,
- filepath.Join(pulseBinDir(), "pulse-agent"),
- "/opt/pulse/pulse-agent",
- filepath.Join("/app", "pulse-agent"),
- filepath.Join(r.projectRoot, "bin", "pulse-agent"),
- )
-
for _, candidate := range searchPaths {
if candidate == "" {
continue
@@ -154,5 +157,11 @@ func (r *Router) handleDownloadUnifiedAgent(w http.ResponseWriter, req *http.Req
return
}
- http.Error(w, "Agent binary not found", http.StatusNotFound)
+ // Provide helpful error message
+ if normalized != "" {
+ log.Warn().Str("arch", normalized).Msg("Unified agent binary not found for requested architecture")
+ http.Error(w, "Agent binary not found for architecture: "+normalized, http.StatusNotFound)
+ } else {
+ http.Error(w, "Agent binary not found", http.StatusNotFound)
+ }
}