mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-08-29 09:49:33 +03:00
cli: data_to_text: never render undefined values
To make it visible when the API return undefined values. Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
4ac8500023
commit
3cd6f2f350
@ -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 });
|
||||
|
Reference in New Issue
Block a user