[pve-devel] [qemu-server cli cleanup 2/6] qm config: use print_api_result

Dietmar Maurer dietmar at proxmox.com
Thu Aug 9 11:43:43 CEST 2018


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 PVE/CLI/qm.pm | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index 8f45138..8d9e9ec 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -787,16 +787,14 @@ our $cmddef = {
 
     config => [ "PVE::API2::Qemu", 'vm_config', ['vmid'],
 		{ node => $nodename }, sub {
-		    my $config = shift;
-		    foreach my $k (sort (keys %$config)) {
-			next if $k eq 'digest';
-			my $v = $config->{$k};
-			if ($k eq 'description') {
-			    $v = PVE::Tools::encode_text($v);
-			}
-			print "$k: $v\n";
-		    }
-		}],
+		    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],
 
     pending => [ "PVE::API2::Qemu", 'vm_pending', ['vmid'],
 		{ node => $nodename }, sub {
-- 
2.11.0




More information about the pve-devel mailing list