mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-06 08:45:35 +00: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:
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 });
|
||||
|
Loading…
Reference in New Issue
Block a user