summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Parent <math.parent@gmail.com>2009-12-13 19:48:26 (GMT)
committerMathieu Parent <math.parent@gmail.com>2009-12-13 19:48:26 (GMT)
commit9be5a0899889d4cb76876c29b9748dd384b54f30 (patch)
treec3b9effcd30435fda4c2d7dbbd11a6fc8a0de7f6
parentc2a016601ca62d9ed13e7aa96ae93aa378b17d95 (diff)
downloadperl-Kolab-9be5a0899889d4cb76876c29b9748dd384b54f30.tar.gz
Added arguments to rebuildTemplates(): dorunonchange and templates.
Use those in kolab_bootstrap (in replacement of bootstrapConfig()).
-rw-r--r--ChangeLog6
-rw-r--r--lib/Kolab/Conf.pm33
2 files changed, 16 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 63460ec..c3a152c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-12-13 Mathieu Parent <math.parent@gmail.com>
+ * lib/Kolab/Conf.pm, sbin/kolab_bootstrap.in:
+ Added arguments to rebuildTemplates(): dorunonchange and templates.
+ Use those in kolab_bootstrap (in replacement of bootstrapConfig()).
+
+2009-12-13 Mathieu Parent <math.parent@gmail.com>
+
* lib/Kolab/Conf.pm: Touch configuration only when there is a change.
This avoid postfix complaining about "database X.db is older than
source file X".
diff --git a/lib/Kolab/Conf.pm b/lib/Kolab/Conf.pm
index 424224c..799e380 100644
--- a/lib/Kolab/Conf.pm
+++ b/lib/Kolab/Conf.pm
@@ -597,6 +597,8 @@ sub rebuildTemplates
{
my %args = @_;
$args{doreload} = 1 if !exists $args{doreload};
+ $args{dorunonchange} = 1 if !exists $args{dorunonchange};
+ #$args{templates} = ALL if !exists $args{templates};
my $key;
my $value;
@@ -610,15 +612,22 @@ sub rebuildTemplates
Kolab::log('T', 'Loading meta-template data', KOLAB_DEBUG );
loadMetaTemplates( $templatedir, \%templates, \%permissions, \%ownership, \%runonchange, \%commentchar );
+ # defaults to all templates
+ $args{templates} = [ keys %templates ] if !exists $args{templates};
my $cfg;
my $tpl;
- foreach $tpl (keys %templates) {
+ foreach $tpl (@{$args{templates}}) {
$cfg = $templates{$tpl};
build($tpl, $cfg, $ownership{$cfg}, $permissions{$cfg}, $commentchar{$cfg});
}
Kolab::log('T', 'Finished regenerating configuration files', KOLAB_DEBUG );
+ if(!$args{dorunonchange}) {
+ Kolab::log('T', 'RUNONCHANGE will not be executed, as requested.', KOLAB_DEBUG );
+ return;
+ }
+
my %cmds = ();
foreach $key (keys %runonchange) {
if (defined $confighaschanged{$key}) {
@@ -643,28 +652,6 @@ sub rebuildTemplates
}
}
-sub bootstrapConfig
-{
- my $templatedir = $Kolab::config{"templatedir"};
-
- # FIXME: it would be better if the templates can be given as an
- # argument to this function.
- my @templ = ("$templatedir/slapd.access.template",
- "$templatedir/slapd.conf.template",
- "$templatedir/slapd.replicas.template");
-
- my %runonchange;
-
- loadMetaTemplates( $templatedir, \%templates, \%permissions, \%ownership, \%runonchange, \%commentchar );
-
- my $cfg;
- my $out;
- foreach my $tpl (@templ) {
- $cfg = $templates{$tpl};
- build($tpl, $cfg, $ownership{$cfg}, $permissions{$cfg}, $commentchar{$cfg});
- }
-}
-
sub checkPermissions {
my $key;
my $value;