]> git.proxmox.com Git - pmg-api.git/commitdiff
rewrite config log followup: move common log message out in closure
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 12 Apr 2019 08:01:09 +0000 (10:01 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 12 Apr 2019 08:01:09 +0000 (10:01 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PMG/Config.pm

index ce931e558043ad5c88d7a7fdbf5f047d2f1a63cf..89e68f6039db465f06d38034d3dd3eb72c0c9d73 100755 (executable)
@@ -1550,9 +1550,13 @@ sub rewrite_config {
 
     $force_restart = {} if ! $force_restart;
 
+    my $log_restart = sub {
+       syslog ('info', "configuration change detected for '$_[0]', restarting");
+    };
+
     if (($self->rewrite_config_postfix($rulecache) && $restart_services) ||
        $force_restart->{postfix}) {
-       syslog ('info', 'configuration change detected - postfix');
+       $log_restart->('postfix');
        PMG::Utils::service_cmd('postfix', 'reload');
     }
 
@@ -1567,19 +1571,19 @@ sub rewrite_config {
 
     if (($self->rewrite_config_spam() && $restart_services) ||
        $force_restart->{spam}) {
-       syslog ('info', 'configuration change detected - pmg-smtp-filter');
+       $log_restart->('pmg-smtp-filter');
        PMG::Utils::service_cmd('pmg-smtp-filter', 'restart');
     }
 
     if (($self->rewrite_config_clam() && $restart_services) ||
        $force_restart->{clam}) {
-       syslog ('info', 'configuration change detected - clamav-daemon');
+       $log_restart->('clamav-daemon');
        PMG::Utils::service_cmd('clamav-daemon', 'restart');
     }
 
     if (($self->rewrite_config_freshclam() && $restart_services) ||
        $force_restart->{freshclam}) {
-       syslog ('info', 'configuration change detected - clamav-freshclam');
+       $log_restart->('clamav-freshclam');
        PMG::Utils::service_cmd('clamav-freshclam', 'restart');
     }
 }