diff options
author | Mathieu Parent <math.parent@gmail.com> | 2009-12-13 19:48:26 (GMT) |
---|---|---|
committer | Mathieu Parent <math.parent@gmail.com> | 2009-12-13 19:48:26 (GMT) |
commit | 9be5a0899889d4cb76876c29b9748dd384b54f30 (patch) | |
tree | c3b9effcd30435fda4c2d7dbbd11a6fc8a0de7f6 /lib | |
parent | c2a016601ca62d9ed13e7aa96ae93aa378b17d95 (diff) | |
download | perl-Kolab-9be5a0899889d4cb76876c29b9748dd384b54f30.tar.gz |
Added arguments to rebuildTemplates(): dorunonchange and templates.
Use those in kolab_bootstrap (in replacement of bootstrapConfig()).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kolab/Conf.pm | 33 |
1 files changed, 10 insertions, 23 deletions
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; |