[pve-devel] [PATCH pve-common 4/5] PVE::CLIHandler::print_api_list - improve format check
Dietmar Maurer
dietmar at proxmox.com
Fri Jun 22 08:00:31 CEST 2018
We can only print lists of objects.
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
src/PVE/CLIHandler.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
index a9ebc47..41ac6c2 100644
--- a/src/PVE/CLIHandler.pm
+++ b/src/PVE/CLIHandler.pm
@@ -495,7 +495,8 @@ sub print_text_table {
sub print_api_list {
my ($data, $returninfo, $props_to_print) = @_;
- die "can only print array result" if $returninfo->{type} ne 'array';
+ die "can only print object lists\n"
+ if !($returninfo->{type} eq 'array' && $returninfo->{items}->{type} eq 'object');
my $returnprops = $returninfo->{items}->{properties};
--
2.11.0
More information about the pve-devel
mailing list