[pve-devel] [PATCH manager] Add all standard output options that are not yet defined

Fabian Ebner f.ebner at proxmox.com
Mon Mar 2 10:21:35 CET 2020


When a property description already contained an option, no
standard output options at all would be added to it, e.g.
'/nodes/NODE/vzdump' already defines its own 'quiet'.
Now all not yet defined options are added to the description.

Fixes
pvesh create /nodes/NODE/vzdump -vmid ID -storage STORAGE
issued from a different node and
pvesh create /nodes/NODE/vzdump -vmid ID -storage STORAGE --output-format json
and maybe other calls.

Reported here: https://forum.proxmox.com/threads/output-format-error-with-pvesh-create.47711/

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/CLI/pvesh.pm | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/PVE/CLI/pvesh.pm b/PVE/CLI/pvesh.pm
index dd389969..370fdb0e 100755
--- a/PVE/CLI/pvesh.pm
+++ b/PVE/CLI/pvesh.pm
@@ -276,14 +276,9 @@ my $extract_std_options = 1;
 my $cond_add_standard_output_properties = sub {
     my ($props) = @_;
 
-    foreach my $opt (keys %$PVE::RESTHandler::standard_output_options) {
-	if (defined($props->{$opt})) {
-	    $extract_std_options = 0;
-	    return $props;
-	}
-    }
+    my $keys = [ grep { !defined($props->{$_}) } keys %$PVE::RESTHandler::standard_output_options ];
 
-    return PVE::RESTHandler::add_standard_output_properties($props);
+    return PVE::RESTHandler::add_standard_output_properties($props, $keys);
 };
 
 sub call_api_method {
-- 
2.20.1





More information about the pve-devel mailing list