5
0
mirror of git://git.proxmox.com/git/pve-common.git synced 2024-12-22 21:33:47 +03:00

print_api_result: skip undefined object values

We use objects to return VM configurations, so we uónly want to display
defined values.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer 2018-07-10 13:51:28 +02:00 committed by Thomas Lamprecht
parent cd6591d38b
commit a05db8b5dd

View File

@ -393,6 +393,7 @@ sub print_api_result {
$props_to_print = [ sort keys %$data ] if !scalar(@$props_to_print);
my $kvstore = [];
foreach my $key (@$props_to_print) {
next if !defined($data->{$key});
push @$kvstore, { key => $key, value => data_to_text($data->{$key}, $result_schema->{properties}->{$key}, $options) };
}
my $schema = { type => 'array', items => { type => 'object' }};