From: Dietmar Maurer Date: Fri, 29 Jun 2018 11:15:25 +0000 (+0200) Subject: cli: data_to_text: never render undefined values X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=3cd6f2f350e141dc5b6153a403790b0456169f3a cli: data_to_text: never render undefined values To make it visible when the API return undefined values. Signed-off-by: Dietmar Maurer --- diff --git a/src/PVE/CLIFormatter.pm b/src/PVE/CLIFormatter.pm index cbe6390..a6c4795 100644 --- a/src/PVE/CLIFormatter.pm +++ b/src/PVE/CLIFormatter.pm @@ -42,6 +42,8 @@ sub println_max { sub data_to_text { my ($data, $propdef) = @_; + return '' if !defined($data); + if (defined($propdef)) { if (my $type = $propdef->{type}) { if ($type eq 'boolean') { @@ -57,7 +59,6 @@ sub data_to_text { return $code->($data); } } - return '' if !defined($data); if (my $class = ref($data)) { return to_json($data, { canonical => 1 });