From 7d1b353b09f571636dce52794d00e85af3d60063 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 28 Jun 2019 08:42:19 +0200 Subject: [PATCH] 5to6: get_pkg: cache version list this is a short running script, so the version list can be re-used, the chance that there where updates in between are slim and racy anyway. IF getting the versions did not succeeded, we still retry on every call though, simpler and ensures a warning is printed in the caller check vicinity. Makes script noticeable faster. Signed-off-by: Thomas Lamprecht --- PVE/CLI/pve5to6.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PVE/CLI/pve5to6.pm b/PVE/CLI/pve5to6.pm index 1a92a473..440c58e6 100644 --- a/PVE/CLI/pve5to6.pm +++ b/PVE/CLI/pve5to6.pm @@ -80,10 +80,11 @@ sub print_header { $print_header_first = 0; } +my $versions; my $get_pkg = sub { my ($pkg) = @_; - my $versions = eval { PVE::API2::APT->versions({ node => $nodename }); }; + $versions = eval { PVE::API2::APT->versions({ node => $nodename }) } if !defined($versions); if (!defined($versions)) { my $msg = "unable to retrieve package version information";