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

Dietmar Maurer dietmar at proxmox.com
Tue Dec 10 11:59:37 CET 2013


> 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";
> +		}
> +

this re-ordering is wrong.

>  		# 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),

This is enough to fix the issue. I just applied this - please can you test again?




More information about the pve-devel mailing list