From 437ade60b5a64e3847fa2c3f4d30a48a5f982e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 16 Jun 2021 13:26:38 +0200 Subject: [PATCH] pve6to7: improve vzdump.cron check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit handle errors, and fix filename referenced in the warning. Signed-off-by: Fabian Grünbichler --- PVE/CLI/pve6to7.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/PVE/CLI/pve6to7.pm b/PVE/CLI/pve6to7.pm index b8263dab..c997f316 100644 --- a/PVE/CLI/pve6to7.pm +++ b/PVE/CLI/pve6to7.pm @@ -563,12 +563,18 @@ sub check_backup_retention_settings { "7.x will no longer keep only the last backup, but all backups"); } - my $vzdump_cron = PVE::Cluster::cfs_read_file('vzdump.cron'); + eval { + my $vzdump_cron = PVE::Cluster::cfs_read_file('vzdump.cron'); - # only warn once, there might be many jobs... - if (scalar(grep { defined($_->{maxfiles}) } $vzdump_cron->{jobs}->@*)) { + # only warn once, there might be many jobs... + if (scalar(grep { defined($_->{maxfiles}) } $vzdump_cron->{jobs}->@*)) { + $pass = 0; + log_warn("/etc/pve/vzdump.cron - $maxfiles_msg"); + } + }; + if (my $err = $@) { $pass = 0; - log_warn("/etc/pve/vzdump_cron - $maxfiles_msg"); + log_warn("unable to parse node's VZDump configuration - $err"); } log_pass("no problems found.") if $pass;