From: Dietmar Maurer Date: Wed, 4 Jul 2018 08:12:04 +0000 (+0200) Subject: config list: correctly return and format data X-Git-Url: https://git.proxmox.com/?p=pve-client.git;a=commitdiff_plain;h=e42d9cfe59f43b5419184cfa7adf250b9e0a6492 config list: correctly return and format data --- diff --git a/PVE/APIClient/Commands/config.pm b/PVE/APIClient/Commands/config.pm index 3b208a0..0b9b9aa 100644 --- a/PVE/APIClient/Commands/config.pm +++ b/PVE/APIClient/Commands/config.pm @@ -13,6 +13,9 @@ use PVE::APIClient::CLIHandler; use base qw(PVE::APIClient::CLIHandler); +my $list_return_props = { %{PVE::APIClient::DefaultsConfig->updateSchema(1)->{properties}} }; +delete $list_return_props->{delete}; + __PACKAGE__->register_method ({ name => 'list', path => 'list', @@ -21,17 +24,19 @@ __PACKAGE__->register_method ({ parameters => { additionalProperties => 0, }, - returns => { type => 'null' }, + returns => { + type => 'object', + properties => $list_return_props, + }, code => sub { my $config = PVE::APIClient::Config->load(); my $defaults = PVE::APIClient::Config->get_defaults($config); + $defaults->{digest} = $config->{digest}; - print Dumper($config); - - return undef; + return $defaults; }}); __PACKAGE__->register_method ({ @@ -82,7 +87,7 @@ __PACKAGE__->register_method ({ our $cmddef = { set => [ __PACKAGE__, 'set',], - list => [__PACKAGE__, 'list'], + list => [__PACKAGE__, 'list', undef, undef, sub { PVE::APIClient::Helpers::print_result(@_);}], }; 1;