]> git.proxmox.com Git - pve-common.git/commitdiff
RESTHandler getopt_usage: schema properties can be undef
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 9 Mar 2020 11:24:07 +0000 (12:24 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 9 Mar 2020 11:26:06 +0000 (12:26 +0100)
While seldom some of our API endpoints do not define it, e.g., the
world readable /access/ticket call.

As all of the stack can cope with that just fine make getopt_usage
also follow that behavior and don't assume that properties has to be
defined.

This fixes a complaint about undefined value use in the following
calls:
 pvesh usage /access/ticket
 pmgsh help /access

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/RESTHandler.pm

index 299bf6893d1cf4a2e5cd90ca0d8a4d83f2936903..60731acf11375a3db1b8d57af91e5834753dd3ea 100644 (file)
@@ -621,7 +621,10 @@ sub getopt_usage {
 
     my $schema = $info->{parameters};
     my $name = $info->{name};
 
     my $schema = $info->{parameters};
     my $name = $info->{name};
-    my $prop = { %{$schema->{properties}} }; # copy
+    my $prop =  {};
+    if ($schema->{properties}) {
+       $prop = { %{$schema->{properties}} }; # copy
+    }
 
     my $has_output_format_option = $formatter_properties->{'output-format'} ? 1 : 0;
 
 
     my $has_output_format_option = $formatter_properties->{'output-format'} ? 1 : 0;