fix: chemin complet /usr/sbin/pct pour les sessions SSH non-interactives
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 <noreply@anthropic.com>
This commit is contained in:
parent
8019b1475d
commit
8ff6fb0e8c
1 changed files with 5 additions and 5 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue