[pve-devel] [pve-container cli cleanup 2/5] pct config: use print_api_result
Dietmar Maurer
dietmar at proxmox.com
Thu Aug 9 11:43:40 CEST 2018
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
src/PVE/CLI/pct.pm | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 8cc57c3..5e2bcc5 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -722,25 +722,14 @@ our $cmddef = {
my $proplist = ['vmid', 'name', 'status', 'cpus', 'maxmem', 'maxswap', 'maxdisk', 'uptime'];
PVE::CLIFormatter::print_api_result($data, $schema, $proplist, $options);
}, $PVE::RESTHandler::standard_output_options],
- config => [ "PVE::API2::LXC::Config", 'vm_config', ['vmid'],
- { node => $nodename }, sub {
- my $config = shift;
- foreach my $k (sort (keys %$config)) {
- next if $k eq 'digest';
- next if $k eq 'lxc';
- my $v = $config->{$k};
- if ($k eq 'description') {
- $v = PVE::Tools::encode_text($v);
- }
- print "$k: $v\n";
- }
- if (defined($config->{'lxc'})) {
- my $lxc_list = $config->{'lxc'};
- foreach my $lxc_opt (@$lxc_list) {
- print "$lxc_opt->[0]: $lxc_opt->[1]\n"
- }
- }
- }],
+ config => [ "PVE::API2::LXC::Config", 'vm_config', ['vmid'], { node => $nodename }, sub {
+ my ($data, $schema, $options) = @_;
+
+ $data->{description} = PVE::Tools::encode_text($data->{description})
+ if defined($data->{description});
+
+ PVE::CLIFormatter::print_api_result($data, $schema, undef, $options);
+ }, $PVE::RESTHandler::standard_output_options],
set => [ 'PVE::API2::LXC::Config', 'update_vm', ['vmid'], { node => $nodename }],
resize => [ "PVE::API2::LXC", 'resize_vm', ['vmid', 'disk', 'size'], { node => $nodename } ],
--
2.11.0
More information about the pve-devel
mailing list