[pve-devel] [PATCH common v2 1/3] cli_handler: don't clobber existing options

Stoiko Ivanov s.ivanov at proxmox.com
Mon Jul 16 20:58:58 CEST 2018


If an API call has one of the standard_output_options defined (e.g. format for
diskimages, quiet for vzdump), it would get overridden by the
standard_output_option. Instead add an 'output-' prefix in that case.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PVE/RESTHandler.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm
index af9024e..35e46eb 100644
--- a/src/PVE/RESTHandler.pm
+++ b/src/PVE/RESTHandler.pm
@@ -777,6 +777,12 @@ sub add_standard_output_parameters {
     my ($org_schema) = @_;
 
     my $schema = { %$org_schema };
+
+    foreach my $prop (keys %{$schema->{properties}}) {
+	if (exists($standard_output_options->{$prop})) {
+	    $standard_output_options->{'output-'.$prop} = delete $standard_output_options->{$prop};
+	}
+    }
     $schema->{properties} = { %{$schema->{properties}}, %$standard_output_options };
 
     return $schema;
-- 
2.11.0





More information about the pve-devel mailing list