fix(engine-b): run guest-agent commands through /bin/sh -c

The Proxmox guest agent execs a program directly; our compound commands
(cd/&&/pipes/redirects/env) need an explicit shell.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/portal-design
nexxo 2026-07-25 12:25:24 +02:00
parent f43ade79b0
commit e0e4c4e18d
1 changed files with 5 additions and 2 deletions

View File

@ -95,8 +95,11 @@ class HttpProxmoxClient implements ProxmoxClient
public function guestExec(string $node, int $vmid, string $command): array
{
$pid = $this->http()->asForm()
->post("/nodes/{$node}/qemu/{$vmid}/agent/exec", ['command' => $command])
// The guest agent runs a program directly, not a shell — wrap compound
// commands (cd/&&/pipes/redirects/env) in an explicit shell. command is a
// JSON array so each argument is passed safely without re-quoting.
$pid = $this->http()
->post("/nodes/{$node}/qemu/{$vmid}/agent/exec", ['command' => ['/bin/sh', '-c', $command]])
->throw()->json('data.pid');
// Poll exec-status until the command has exited.