[pve-devel] [RFC v2 container 1/1] print_ct_warn_log: use log_warn function from RESTEnvironment
Fabian Ebner
f.ebner at proxmox.com
Fri Oct 29 13:16:24 CEST 2021
No functional change is intended.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
No changes from v1.
Dependency bump for pve-common is needed.
src/PVE/LXC.pm | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index b07d986..aed20a3 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -29,11 +29,11 @@ use PVE::Tools qw(
$IPV4RE
$IPV6RE
);
-use PVE::RPCEnvironment;
use PVE::CpuSet;
use PVE::Network;
use PVE::AccessControl;
use PVE::ProcFSTools;
+use PVE::RESTEnvironment;
use PVE::Syscall qw(:fsmount);
use PVE::LXC::Config;
use PVE::GuestHelpers qw(safe_string_ne safe_num_ne safe_boolean_ne);
@@ -2306,13 +2306,8 @@ my sub print_ct_warn_log {
my $log = eval { file_get_contents($log_fn) };
return if !$log;
- my $rpcenv = eval { PVE::RPCEnvironment::get() };
-
- my $warn_fn = $rpcenv ? sub { $rpcenv->warn($_[0]) } : sub { print STDERR "WARN: $_[0]\n" };
-
while ($log =~ /^\h*\s*(.*?)\h*$/gm) {
- my $line = $1;
- $warn_fn->($line);
+ PVE::RESTEnvironment::log_warn($1);
}
unlink $log_fn or warn "could not unlink '$log_fn' - $!\n";
}
--
2.30.2
More information about the pve-devel
mailing list