cli: use guesthelper for pending

use the shared format_pending method from guesthelpers

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
This commit is contained in:
Oguz Bektas 2019-10-14 10:28:39 +02:00 committed by Thomas Lamprecht
parent 98bc3aeb92
commit 5c39708eb3

View File

@ -898,33 +898,7 @@ our $cmddef = {
}
}],
pending => [ "PVE::API2::Qemu", 'vm_pending', ['vmid'],
{ node => $nodename }, sub {
my $data = shift;
foreach my $item (sort { $a->{key} cmp $b->{key}} @$data) {
my $k = $item->{key};
next if $k eq 'digest';
my $v = $item->{value};
my $p = $item->{pending};
if ($k eq 'description') {
$v = PVE::Tools::encode_text($v) if defined($v);
$p = PVE::Tools::encode_text($p) if defined($p);
}
if (defined($v)) {
if ($item->{delete}) {
print "del $k: $v\n";
} elsif (defined($p)) {
print "cur $k: $v\n";
print "new $k: $p\n";
} else {
print "cur $k: $v\n";
}
} elsif (defined($p)) {
print "new $k: $p\n";
}
}
}],
pending => [ "PVE::API2::Qemu", 'vm_pending', ['vmid'], { node => $nodename }, \&PVE::GuestHelpers::format_pending ],
showcmd => [ __PACKAGE__, 'showcmd', ['vmid']],
status => [ __PACKAGE__, 'status', ['vmid']],