fix(engine-b): Proxmox config uses PUT; guest-agent exec is form-encoded

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/portal-design
nexxo 2026-07-25 12:48:58 +02:00
parent 778bb7f117
commit 8825f9abfe
1 changed files with 5 additions and 4 deletions

View File

@ -64,7 +64,8 @@ class HttpProxmoxClient implements ProxmoxClient
public function setCloudInit(string $node, int $vmid, array $params): void public function setCloudInit(string $node, int $vmid, array $params): void
{ {
$this->http()->asForm()->post("/nodes/{$node}/qemu/{$vmid}/config", $params)->throw(); // PUT is the (synchronous) VM config-update operation in Proxmox.
$this->http()->asForm()->put("/nodes/{$node}/qemu/{$vmid}/config", $params)->throw();
} }
public function resizeDisk(string $node, int $vmid, string $disk, string $size): void public function resizeDisk(string $node, int $vmid, string $disk, string $size): void
@ -96,9 +97,9 @@ class HttpProxmoxClient implements ProxmoxClient
public function guestExec(string $node, int $vmid, string $command): array public function guestExec(string $node, int $vmid, string $command): array
{ {
// The guest agent runs a program directly, not a shell — wrap compound // The guest agent runs a program directly, not a shell — wrap compound
// commands (cd/&&/pipes/redirects/env) in an explicit shell. command is a // commands (cd/&&/pipes/redirects/env) in an explicit shell. Proxmox is
// JSON array so each argument is passed safely without re-quoting. // form-encoded and takes `command` as an argv list.
$pid = $this->http() $pid = $this->http()->asForm()
->post("/nodes/{$node}/qemu/{$vmid}/agent/exec", ['command' => ['/bin/sh', '-c', $command]]) ->post("/nodes/{$node}/qemu/{$vmid}/agent/exec", ['command' => ['/bin/sh', '-c', $command]])
->throw()->json('data.pid'); ->throw()->json('data.pid');