[pve-devel] applied: [PATCH pve-manager 1/1] Fix #1982 Check handler exists

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jan 15 19:01:27 CET 2019


On 1/15/19 10:32 AM, Christian Ebner wrote:
> Checks that the handler for the API call even exists before verifying the
> parameter schema. By this the reported error message is more descriptive.
> 
> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
>  PVE/CLI/pvesh.pm | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/CLI/pvesh.pm b/PVE/CLI/pvesh.pm
> index 41e27a00..9b8e3245 100755
> --- a/PVE/CLI/pvesh.pm
> +++ b/PVE/CLI/pvesh.pm
> @@ -208,17 +208,21 @@ sub resource_cap {
>  sub extract_path_info {
>      my ($uri_param) = @_;
>  
> -    my $info;
> +    my ($handler, $info);
>  
>      my $test_path_properties = sub {
>  	my ($method, $path) = @_;
> -	(undef, $info) = PVE::API2->find_handler($method, $path, $uri_param);
> +	($handler, $info) = PVE::API2->find_handler($method, $path, $uri_param);
>      };
>  
>      if (defined(my $cmd = $ARGV[0])) {
>  	if (my $method = $method_map->{$cmd}) {
>  	    if (my $path = $ARGV[1]) {
>  		$test_path_properties->($method, $path);
> +		if (!defined($handler)) {
> +		    print STDERR "No '$cmd' handler defined for '$path'\n";
> +		    exit(1);
> +		}
>  	    }
>  	} elsif ($cmd eq 'bashcomplete') {
>  	    my $cmdline = substr($ENV{COMP_LINE}, 0, $ENV{COMP_POINT});
> 

applied, thanks! Slightly modified your commit messages subject to:
> Fix #1982: pvesh: check if a handler exists for path




More information about the pve-devel mailing list