From 8ff6fb0e8cf1c5ff5560f5ec78aabf882ca2b33f Mon Sep 17 00:00:00 2001 From: enzo Date: Sat, 21 Mar 2026 01:23:29 +0100 Subject: [PATCH] fix: chemin complet /usr/sbin/pct pour les sessions SSH non-interactives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pct n'est pas dans le PATH SSH par défaut (exit 127). Corrigé dans GetPackages, GetTargets et executeUpdate. Co-Authored-By: Claude Sonnet 4.6 --- backend/internal/api/updates.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/internal/api/updates.go b/backend/internal/api/updates.go index 6b7f128..ba2a28d 100644 --- a/backend/internal/api/updates.go +++ b/backend/internal/api/updates.go @@ -77,7 +77,7 @@ func (h *UpdatesHandler) GetTargets(w http.ResponseWriter, r *http.Request) { {ID: "host", Name: "Proxmox Host", Status: "running"}, } - output, err := h.sshPool.RunCommand(sshHost, sshUser, sshPass, "pct list 2>/dev/null") + output, err := h.sshPool.RunCommand(sshHost, sshUser, sshPass, "/usr/sbin/pct list 2>/dev/null") if err == nil { for _, line := range strings.Split(output, "\n") { line = strings.TrimSpace(line) @@ -130,7 +130,7 @@ func (h *UpdatesHandler) GetPackages(w http.ResponseWriter, r *http.Request) { command = "apt list --upgradable 2>/dev/null" case len(target) > 4 && target[:4] == "lxc:": lxcID := target[4:] - command = fmt.Sprintf("pct exec %s -- apt list --upgradable 2>/dev/null", lxcID) + command = fmt.Sprintf("/usr/sbin/pct exec %s -- apt list --upgradable 2>/dev/null", lxcID) default: JSONError(w, "Cible invalide", http.StatusBadRequest) return @@ -289,14 +289,14 @@ func (h *UpdatesHandler) executeUpdate(jobID, target, sshHost, sshUser, sshPass case len(target) > 4 && target[:4] == "lxc:": lxcID := target[4:] command = fmt.Sprintf( - "pct exec %s -- bash -c 'DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y'", + "/usr/sbin/pct exec %s -- bash -c 'DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y'", lxcID, ) case target == "all": - command = `for ct in $(pct list | awk 'NR>1 {print $1}'); do + command = `for ct in $(/usr/sbin/pct list | awk 'NR>1 {print $1}'); do echo "=== LXC $ct ===" - pct exec $ct -- bash -c 'DEBIAN_FRONTEND=noninteractive apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y' 2>/dev/null || echo "SKIP LXC $ct" + /usr/sbin/pct exec $ct -- bash -c 'DEBIAN_FRONTEND=noninteractive apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y' 2>/dev/null || echo "SKIP LXC $ct" done` default: