From 015ee893d9a644c85dd24c70774e77d9c0a84503 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 13 Feb 2025 10:47:55 -0400 Subject: [PATCH] MT#59979 defuse license logs A missing license is allowable on CE systems. Don't log errors if license is missing. Don't die if sysopen() fails. Change-Id: I00c8ecf361548da6452f1b631d308d9aa8901368 --- lib/NGCP/Panel/Utils/License.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/NGCP/Panel/Utils/License.pm b/lib/NGCP/Panel/Utils/License.pm index af26909ccd..b41bd1e337 100644 --- a/lib/NGCP/Panel/Utils/License.pm +++ b/lib/NGCP/Panel/Utils/License.pm @@ -13,9 +13,10 @@ sub get_license_status { my $fd; { - no autodie qw(open); + no autodie qw(sysopen); if (!sysopen($fd, '/proc/ngcp/check', O_NONBLOCK|O_RDONLY)) { - $c->log->error('License status check failed: could not check license'); + $c->log->error('License status check failed: could not check license') + unless $c->config->{general}{ngcp_type} eq 'spce'; return 'missing'; } } @@ -80,7 +81,8 @@ sub get_license { my $proc_dir = '/proc/ngcp/flags'; unless (-d $proc_dir) { - $c->log->error("Failed to access $proc_dir"); + $c->log->error("Failed to access $proc_dir") + unless $c->config->{general}{ngcp_type} eq 'spce'; return; }; @@ -105,7 +107,8 @@ sub get_licenses { my $proc_dir = '/proc/ngcp/flags'; unless (-d $proc_dir) { - $c->log->error("Failed to access $proc_dir"); + $c->log->error("Failed to access $proc_dir") + unless $c->config->{general}{ngcp_type} eq 'spce'; return; }; @@ -138,7 +141,8 @@ sub get_license_meta { my $proc_dir = '/proc/ngcp'; unless (-d $proc_dir) { - $c->log->error("Failed to access $proc_dir"); + $c->log->error("Failed to access $proc_dir") + unless $c->config->{general}{ngcp_type} eq 'spce'; return; };