[pve-devel] [PATCH pve-common 2/5] PVE::CLIHandler::print_api_list - allow to pass empty $props_to_print

Stoiko Ivanov s.ivanov at proxmox.com
Fri Jun 22 20:18:28 CEST 2018


On Fri, Jun 22, 2018 at 04:27:57PM +0200, Dietmar Maurer wrote:
> 
> 
> > On June 22, 2018 at 3:27 PM Stoiko Ivanov <s.ivanov at proxmox.com> wrote:
> > 
> > 
> > On Fri, Jun 22, 2018 at 08:00:29AM +0200, Dietmar Maurer wrote:
> > > Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> > > ---
> > >  src/PVE/CLIHandler.pm | 11 +++++++++--
> > >  1 file changed, 9 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
> > > index b46d87e..b4c95ef 100644
> > > --- a/src/PVE/CLIHandler.pm
> > > +++ b/src/PVE/CLIHandler.pm
> > > @@ -499,6 +499,14 @@ sub print_api_list {
> > >  
> > >      my $returnprops = $returninfo->{items}->{properties};
> > >  
> > > +    if (!defined($props_to_print)) {
> > > +	$props_to_print = [ sort keys %$returnprops ];
> > > +	if (!scalar(@$props_to_print)) {
> > > +	    $props_to_print = [ sort keys %{$data->[0]} ];
> > 
> > Maybe we could take the union of occuring keys in all 'rows' of data? (I'm
> > volunteering for a follow-up-patch)
> 
> yes, please :-)

will post as a reply to this mail. print_text_table was relying on the first
column of data to contain no undef values - tried to address that as well.




More information about the pve-devel mailing list