thomas: server/perl-kolab/lib/Kolab Conf.pm,1.7,1.8

cvs at kolab.org cvs at kolab.org
Tue Mar 17 17:46:33 CET 2009


Author: thomas

Update of /kolabrepository/server/perl-kolab/lib/Kolab
In directory doto:/tmp/cvs-serv9657/perl-kolab/lib/Kolab

Modified Files:
	Conf.pm 
Log Message:
Use RUNONCHANGE mechanism for postfix reload and postmap.

Adding entries to virtual.template and transport.template from LDAP ist the
remaining postfix handling in kolabconf.

header_checks.template, ldapdistlist.cf.template and ldapvirtual.cf.template.in
need no RUNONCHANGE, because
- regexp or ldap tables do not need postmap
- they are used by the short-living cleanup, no postfix reload needed


Index: Conf.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/lib/Kolab/Conf.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Conf.pm	17 Mar 2009 14:12:56 -0000	1.7
+++ Conf.pm	17 Mar 2009 16:46:31 -0000	1.8
@@ -42,7 +42,6 @@
 
 our %EXPORT_TAGS = (
     'all' => [ qw(
-        &buildPostfixTransportMap
         &buildCyrusGroups
         &buildLDAPReplicas
         &rebuildTemplates
@@ -282,16 +281,12 @@
 
     move($config->filename, $cfg) || Kolab::log('T', "Error moving configfile to $cfg, error: $!", KOLAB_ERROR );
     fixup( $cfg, $owner, $perm );
-    #chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $cfg);
-    #chmod(0600, $cfg) if ($cfg =~ /openldap/);
 
     if (-f $oldcfg && !defined $special_templates{$tmpl} ) {
         my $rc = `diff -q $cfg $oldcfg`;
         chomp($rc);
         if ($rc) {
-            if ($cfg =~ /postfix/) {
-                $haschanged{'postfix'} = 1;
-            } elsif ($cfg =~ /openldap/) {
+            if ($cfg =~ /openldap/) {
                 $haschanged{'slapd'} = 1;
             } elsif ($cfg =~ /imapd/) {
                 $haschanged{'imapd'} = 1;
@@ -305,16 +300,6 @@
     Kolab::log('T', "Finished creating configuration file `$cfg'", KOLAB_DEBUG );
 }
 
-sub buildPostfixTransportMap
-{
-    buildPostfixMap( 'transport' );
-}
-
-sub buildPostfixVirtualMap
-{
-    buildPostfixMap( 'virtual' );
-}
-
 sub buildPostfixMap
 {
     my $map = shift;
@@ -326,14 +311,8 @@
     my $cfg = $templates{$keytemplate};
     my $oldcfg = $cfg . '.old';
 
-    #my $oldmask = umask 077;
-    #copy($cfg, $oldcfg);
-    #chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
-    #umask $oldmask;
-    #delete $templates{$keytemplate};
-
-    my $transport;
-    if (!($transport = IO::File->new($cfg, 'a'))) {
+    my $cfgfile;
+    if (!($cfgfile = IO::File->new($cfg, 'a'))) {
         Kolab::log('T', "Unable to create Postfix $map map: $!", KOLAB_ERROR);
         exit(1);
     }
@@ -362,7 +341,7 @@
             foreach (@$routes) {
                 $_ = trim($_);
                 Kolab::log('T', "Adding entry `$_' to $map");
-                print $transport $_ . "\n";
+                print $cfgfile $_ . "\n";
             }
         }
     } else {
@@ -370,22 +349,18 @@
     }
 
     Kolab::LDAP::destroy($ldap);
-    $transport->close;
-
-    # FIXME: bad way of doing things...
-    #system("chown root:root @emailserver_confdir@/*");
-    fixup( $cfg, $ownership{$cfg}, $permissions{$cfg});
-    system("$Kolab::config{'postmapping'}/$map");
+    $cfgfile->close;
 
     if (-f $oldcfg) {
         my $rc = `diff -q $cfg $oldcfg`;
         chomp($rc);
         if ($rc) {
-	    Kolab::log('T', "`$cfg' change detected: $rc", KOLAB_DEBUG);
-	    $haschanged{'postfix'} = 1;
+            Kolab::log('T', "`$cfg' change detected: $rc", KOLAB_DEBUG);
+            $templatehaschanged{$keytemplate} = 1;
         }
     } else {
-        $haschanged{'postfix'} = 1;
+        Kolab::log('T', "`$cfg' creation detected", KOLAB_DEBUG);
+        $templatehaschanged{$keytemplate} = 1;
     }
 
     Kolab::log('T', "Finished building Postfix $map map", KOLAB_DEBUG);
@@ -750,8 +725,8 @@
         build($tpl, $cfg, $ownership{$cfg}, $permissions{$cfg}, $commentchar{$cfg});
      }
 
-    buildPostfixTransportMap;
-    buildPostfixVirtualMap;
+    buildPostfixMap('transport');
+    buildPostfixMap('virtual');
     buildLDAPAccess;
     buildLDAPReplicas;
     buildCyrusGroups;
@@ -833,11 +808,6 @@
     if ($haschanged{'slapd'}) {
         &Kolab::log('K', 'Restarting OpenLDAP...');
         system("$Kolab::config{'KOLABRC'} rc openldap restart &");
-    }
-
-    if ($haschanged{'postfix'}) {
-        &Kolab::log('K', 'Reloading Postfix...');
-        system("$Kolab::config{sbindir}/postfix reload");
     }
 
     if ($haschanged{'imapd'}) {





More information about the commits mailing list