From 0ad27f8ff4419ab7c8cf28ef7f77559be161ada9 Mon Sep 17 00:00:00 2001 From: James Rouzier Date: Fri, 22 Jul 2016 16:51:36 -0400 Subject: [PATCH] Do not start a pfdetect queue worker if pfdetect is disabled Fixes #1593 --- .../pfappserver/root/config/pfdetect/index.tt | 2 +- sbin/pfqueue | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/html/pfappserver/root/config/pfdetect/index.tt b/html/pfappserver/root/config/pfdetect/index.tt index 41f7b0a64f52..0d66f7912a34 100644 --- a/html/pfappserver/root/config/pfdetect/index.tt +++ b/html/pfappserver/root/config/pfdetect/index.tt @@ -17,7 +17,7 @@

[% l('Syslog Parsers') %]

- [% l('Warning!') %] [% l('Any change to the syslog parsers requires a restart of the pfdetect service.') %] + [% l('Warning!') %] [% l('Any change to the syslog parsers requires a restart of the pfdetect and pfqueue service.') %]
[% INCLUDE config/pfdetect/list.tt %] diff --git a/sbin/pfqueue b/sbin/pfqueue index e14845fc2417..fd9a97ba0124 100755 --- a/sbin/pfqueue +++ b/sbin/pfqueue @@ -34,6 +34,7 @@ BEGIN { use pf::file_paths qw($var_dir);; use pf::util; +use pf::constants qw($TRUE $FALSE); use pf::config::pfqueue; use pf::services::util; use pf::db; @@ -45,6 +46,8 @@ use pf::client; pf::client::setClient("pf::api::can_fork"); use threads; use pf::factory::task; +use pf::services::manager::pfdetect; + # initialization @@ -116,6 +119,9 @@ Register all tasks sub register_tasks { foreach my $queue_config (@{$ConfigPfqueue{queues}} ) { my $name = $queue_config->{name}; + if (skip_queue($name)) { + next; + } my $worker = $queue_config->{workers}; foreach (1 .. $worker) { register_task("Queue:$name",\&process_queue, { queue_name => "Queue:$name"}); @@ -387,6 +393,21 @@ sub get_consumer { return $consumer; } +=head2 skip_queue + + + +=cut + +sub skip_queue { + my ($name) = @_; + if ($name eq 'pfdetect') { + my $manger = pf::services::manager::pfdetect->new; + return $manger->isManaged ? $FALSE : $TRUE; + } + return $FALSE; +} + =head1 AUTHOR Inverse inc.