[pve-devel] [PATCH pve-manager 2/2] pvesh: send params to check_proxyto like httpserver

Alexandre Derumier aderumier at odiso.com
Thu Jun 1 08:50:11 CEST 2023


Currently only url_params are send to check_proxyto, the behaviour
is different than httpserver.

for example, so we can't retreive "pvesh create ... --node" param
in proxyto_callback

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/CLI/pvesh.pm | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/PVE/CLI/pvesh.pm b/PVE/CLI/pvesh.pm
index 9acf292a..f83e05aa 100755
--- a/PVE/CLI/pvesh.pm
+++ b/PVE/CLI/pvesh.pm
@@ -300,16 +300,19 @@ sub call_api_method {
 	die "no '$cmd' handler for '$path'\n";
     }
 
+    for my $p (sort keys %{$param}) {
+	if (defined($uri_param->{$p}) && $uri_param->{$p} ne $param->{$p}) {
+	    die "duplicate parameter $p (already defined in URI) with conflicting values!\n";
+	}
+	$uri_param->{$p} = $param->{$p};
+    }
+
     my $data;
     my ($node, $remip) = check_proxyto($info, $uri_param);
     if ($node) {
 	$data = proxy_handler($node, $remip, $path, $cmd, $param);
     } else {
-	foreach my $p (keys %$uri_param) {
-	    $param->{$p} = $uri_param->{$p};
-	}
-
-	$data = $handler->handle($info, $param);
+	$data = $handler->handle($info, $uri_param);
     }
 
     return if $opt_nooutput || $stdopts->{quiet};
-- 
2.30.2





More information about the pve-devel mailing list