* [pve-devel] [PATCH manager] pvesh: proxy handler: fix handling array parameters
@ 2023-11-17 14:58 Fiona Ebner
2023-11-17 15:17 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2023-11-17 14:58 UTC (permalink / raw)
To: pve-devel
As reported in the community forum and reproduced locally, issuing a
QEMU guest agent command would lead to an error when proxying to
another node:
> root@pve8a2 ~ # pvesh create /nodes/pve8a1/qemu/126/agent/exec --command 'whoami'
> Wide character in die at /usr/share/perl5/PVE/RESTHandler.pm line 918.
> proxy handler failed: Agent error: Guest agent command failed, error was 'Failed to execute child process “ARRAY(0x55842bb161a0)” (No such file or directory)'
Fix it, by splitting up array references correctly.
[0]: https://forum.proxmox.com/threads/136520/
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Not sure if this is the correct place to fix it?
PVE/CLI/pvesh.pm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/PVE/CLI/pvesh.pm b/PVE/CLI/pvesh.pm
index 730e09af..44a65213 100755
--- a/PVE/CLI/pvesh.pm
+++ b/PVE/CLI/pvesh.pm
@@ -109,7 +109,11 @@ sub proxy_handler {
my $args = [];
foreach my $key (keys %$param) {
next if $key eq 'quiet' || $key eq 'output-format'; # just to be sure
- push @$args, "--$key", $_ for split(/\0/, $param->{$key});
+ if (ref($param->{$key}) eq 'ARRAY') {
+ push @$args, "--$key", $_ for $param->{$key}->@*;
+ } else {
+ push @$args, "--$key", $_ for split(/\0/, $param->{$key});
+ }
}
my @ssh_tunnel_cmd = ('ssh', '-o', 'BatchMode=yes', "root\@$remip");
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH manager] pvesh: proxy handler: fix handling array parameters
2023-11-17 14:58 [pve-devel] [PATCH manager] pvesh: proxy handler: fix handling array parameters Fiona Ebner
@ 2023-11-17 15:17 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-11-17 15:17 UTC (permalink / raw)
To: Proxmox VE development discussion, Fiona Ebner
Am 17/11/2023 um 15:58 schrieb Fiona Ebner:
> As reported in the community forum and reproduced locally, issuing a
> QEMU guest agent command would lead to an error when proxying to
> another node:
>
>> root@pve8a2 ~ # pvesh create /nodes/pve8a1/qemu/126/agent/exec --command 'whoami'
>> Wide character in die at /usr/share/perl5/PVE/RESTHandler.pm line 918.
>> proxy handler failed: Agent error: Guest agent command failed, error was 'Failed to execute child process “ARRAY(0x55842bb161a0)” (No such file or directory)'
>
> Fix it, by splitting up array references correctly.
>
> [0]: https://forum.proxmox.com/threads/136520/
>
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>
> Not sure if this is the correct place to fix it?
from a quick check I think this should be fine here, as one should expect
arrays on when handling API stuff since pve-comnmon's 07f136d ("JSONSchema: add
support for array parameter in api calls, cli and config"), like the command for
QGA's exec, which is marked as array.
And here it's centrally enough for pvesh for this use case.
> PVE/CLI/pvesh.pm | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-17 15:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17 14:58 [pve-devel] [PATCH manager] pvesh: proxy handler: fix handling array parameters Fiona Ebner
2023-11-17 15:17 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox