[pve-devel] [PATCH v2 common] fix #1942: workaround for 'quiet' option conflict

David Limbeck d.limbeck at proxmox.com
Mon Oct 8 15:19:24 CEST 2018


workaround for option 'quiet' in VZDump conflicting with
standard_output_options in RESTHandler.pm. this change is not limited to
'quiet' but also allows other options to be overridden as long as their
type property matches.

Signed-off-by: David Limbeck <d.limbeck at proxmox.com>
---
This workaround was proposed by Dietmar. Any better solution?

 src/PVE/RESTHandler.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm
index f645f1b..92a0c9e 100644
--- a/src/PVE/RESTHandler.pm
+++ b/src/PVE/RESTHandler.pm
@@ -810,7 +810,13 @@ sub add_standard_output_properties {
 
     foreach my $opt (@$list) {
 	die "no such standard output option '$opt'\n" if !defined($standard_output_options->{$opt});
-	die "detected overwriten standard CLI parameter '$opt'\n" if defined($res->{$opt});
+	if (defined($res->{$opt})) {
+	    my $opt_type = $standard_output_options->{$opt}->{type};
+	    my $res_opt_type = $res->{$opt}->{type};
+	    if ($res_opt_type ne $opt_type) {
+		die "detected overridden standard CLI parameter '$opt'\n";
+	    }
+	}
 	$res->{$opt} = $standard_output_options->{$opt};
     }
 
-- 
2.11.0





More information about the pve-devel mailing list