[pve-devel] [PATCH common] cli_handler: don't clobber existing options
Stoiko Ivanov
s.ivanov at proxmox.com
Mon Jul 16 14:44:48 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>
---
This fixed the problem of the duplicate notifications from scheduled backups
in my tests.
A follow-up of adding the output-options to the usage messages and to
bash-completion is in the workings.
Additionally I would only add the options if an output-sub is defined for a
command.
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