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

Fabian Ebner f.ebner at proxmox.com
Tue Mar 3 09:57:34 CET 2020


On 3/2/20 8:21 PM, Thomas Lamprecht wrote:
> On 3/2/20 10:21 AM, Fabian Ebner wrote:
>> 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(-)
>>
> 
> applied, much thanks. But, this gives me a big déjà vu, as I had seen such a
> patch/fix already, strange.. Anyway, thanks a lot. Would you care to check
> pmgsh from the Mailgateway too (I didn't looked at all if it even can be affected
> by a similar issue, FYI)
>   
> 

I haven't looked at PMG-related stuff before, so I guess it's a good 
time to start. AFAICT there are no such standard output options for PMG. 
There is the --nooutput option, but that one is intended for pmgsh 
directly and needs to be placed before the API path anyways, e.g.
pmgsh ls --nooutput
fails, while
pmgsh --nooutput ls
does the right thing and even if 'ls' would have its own '--nooutput' 
then both
pmgsh ls --nooutput
pmgsh --nooutput ls --nooutput
would pass the '--nooutput' option to the 'ls' call.


>> 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 {
>>
> 
> 




More information about the pve-devel mailing list