From 055b696736e44ae9df78080a5bcd8cbe5b7bd0f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 18 Jun 2021 10:57:10 +0200 Subject: [PATCH] pve6to7: use file_get_contents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit instead of File::Slurp Signed-off-by: Fabian Grünbichler --- PVE/CLI/pve6to7.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PVE/CLI/pve6to7.pm b/PVE/CLI/pve6to7.pm index 412fb30f..fc779e4f 100644 --- a/PVE/CLI/pve6to7.pm +++ b/PVE/CLI/pve6to7.pm @@ -21,7 +21,6 @@ use PVE::Tools qw(run_command split_list); use PVE::QemuServer; use PVE::VZDump::Common; -use File::Slurp; use Term::ANSIColor; use PVE::CLIHandler; @@ -606,7 +605,11 @@ sub check_cifs_credential_location { sub check_custom_pool_roles { log_info("Checking custom roles for pool permissions.."); - my $raw = read_file('/etc/pve/user.cfg'); + my $raw = eval { PVE::Tools::file_get_contents('/etc/pve/user.cfg'); }; + if ($@) { + log_fail("Failed to read '/etc/pve/user.cfg' - $@"); + return; + } my $roles = {}; while ($raw =~ /^\s*(.+?)\s*$/gm) {