public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier <aderumier@odiso.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager 2/2] pvesh: send params to check_proxyto like httpserver
Date: Thu,  1 Jun 2023 08:50:11 +0200	[thread overview]
Message-ID: <20230601065011.2946694-4-aderumier@odiso.com> (raw)
In-Reply-To: <20230601065011.2946694-1-aderumier@odiso.com>

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@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




      parent reply	other threads:[~2023-06-01  6:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01  6:50 [pve-devel] [PATCH-SERIES v2 pve-manager/qemu-server] fix#4689 autofind node with proxyto_callback Alexandre Derumier
2023-06-01  6:50 ` [pve-devel] [PATCH pve-manager 1/2] api2: add /guests path Alexandre Derumier
2023-06-01  6:50 ` [pve-devel] [PATCH qemu-server 1/1] api2: qemu: add proxyto_callback to find node if not defined Alexandre Derumier
2023-06-01  6:50 ` Alexandre Derumier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230601065011.2946694-4-aderumier@odiso.com \
    --to=aderumier@odiso.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal