diff options
author | Angelo Naselli <anaselli@linux.it> | 2014-12-27 16:53:39 +0100 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2014-12-27 16:53:39 +0100 |
commit | 31955382be46d22fc448efeb7d9582810c791378 (patch) | |
tree | ebe93cddcd5ea6edcf94361d1f1f999cb228a36a /lib/AdminPanel | |
parent | 05520bea360068deff24f037455bc4d70ef74760 (diff) | |
download | manatools-31955382be46d22fc448efeb7d9582810c791378.tar manatools-31955382be46d22fc448efeb7d9582810c791378.tar.gz manatools-31955382be46d22fc448efeb7d9582810c791378.tar.bz2 manatools-31955382be46d22fc448efeb7d9582810c791378.tar.xz manatools-31955382be46d22fc448efeb7d9582810c791378.zip |
Check for xinetd services just if xinetd is enabled (avoid warnings at
run time)
Diffstat (limited to 'lib/AdminPanel')
-rw-r--r-- | lib/AdminPanel/Shared/Services.pm | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/AdminPanel/Shared/Services.pm b/lib/AdminPanel/Shared/Services.pm index 030e0de0..4425165b 100644 --- a/lib/AdminPanel/Shared/Services.pm +++ b/lib/AdminPanel/Shared/Services.pm @@ -451,15 +451,20 @@ sub _has_systemd { sub xinetd_services { my $self = shift; - local $ENV{LANGUAGE} = 'C'; - my @xinetd_services; - $ENV{PATH} = "/usr/bin:/usr/sbin"; - foreach (AdminPanel::Shared::RunProgram::rooted_get_stdout("", '/usr/sbin/chkconfig', '--list', '--type', 'xinetd')) { - if (my ($xinetd_name, $on_off) = m!^\t(\S+):\s*(on|off)!) { - push @xinetd_services, [ $xinetd_name, $on_off eq 'on' ]; + my @xinetd_services = (); + + #avoid warning if xinetd is not installed and either enabled + my $ser_info = $self->get_service_info('xinetd'); + if ($ser_info && $ser_info->{enabled} eq "1") { + local $ENV{LANGUAGE} = 'C'; + $ENV{PATH} = "/usr/bin:/usr/sbin"; + foreach (AdminPanel::Shared::RunProgram::rooted_get_stdout("", '/usr/sbin/chkconfig', '--list', '--type', 'xinetd')) { + if (my ($xinetd_name, $on_off) = m!^\t(\S+):\s*(on|off)!) { + push @xinetd_services, [ $xinetd_name, $on_off eq 'on' ]; + } } } - @xinetd_services; + return @xinetd_services; } sub _systemd_services { |