]> git.proxmox.com Git - pve-common.git/commitdiff
print_api_result: skip undefined object values
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 10 Jul 2018 11:51:28 +0000 (13:51 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 10 Jul 2018 11:52:20 +0000 (13:52 +0200)
We use objects to return VM configurations, so we uĆ³nly want to display
defined values.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
src/PVE/CLIFormatter.pm

index 927e5a6449dc3773987765c8fb4beaab02bb4cd4..7a92f7a286dbd630a34fe392e37d9cade211fe37 100644 (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' }};