[pve-devel] [PATCH] fix execute API again

Stefan Priebe s.priebe at profihost.ag
Mon Dec 9 14:59:29 CET 2013


---
 PVE/API2/Nodes.pm |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 37d834d..60b81d8 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -376,22 +376,23 @@ __PACKAGE__->register_method({
 		my $path = "nodes/$param->{node}/$cmd->{path}";
 		
 		my $uri_param = {};
-		my ($handler, $info) = PVE::API2->find_handler($cmd->{method}, $path, $uri_param);
-		if (!$handler || !$info) {
-		    die "no handler for '$path'\n";
-		}
 
 		foreach my $p (keys %{$cmd->{args}}) {
 		    raise_param_exc({ $p => "duplicate parameter" }) if defined($uri_param->{$p});
 		    $uri_param->{$p} = $cmd->{args}->{$p};
 		}
 
+		my ($handler, $info) = PVE::API2->find_handler($cmd->{method}, $path, $uri_param);
+		if (!$handler || !$info) {
+		    die "no handler for '$path'\n";
+		}
+
 		# check access permissions
 		$rpcenv->check_api2_permissions($info->{permissions}, $user, $uri_param);
 
 		push @$res, {
 		    status => HTTP_OK,
-		    data => $handler->handle($info, $cmd->{args}), 
+		    data => $handler->handle($info, $uri_param),
 		};
 	    };
 	    if (my $err = $@) {
-- 
1.7.10.4




More information about the pve-devel mailing list