Skip to content

Commit aa57089

Browse files
authored
Merge pull request #387 from voxpupuli/fix-386
2 parents 74f4f79 + 42b404f commit aa57089

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

manifests/server.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@
3434
Optional[Stdlib::Absolutepath] $krb5_keytab_file = undef,
3535
Optional[String] $ldap_config_backend = undef,
3636
Optional[Boolean] $enable_memory_limit = undef,
37-
Boolean $manage_policy_rc_d = true,
37+
Optional[Boolean] $manage_policy_rc_d = undef,
3838
) {
3939
include openldap::server::install
4040
include openldap::server::config
4141
include openldap::server::service
4242
include openldap::server::slapdconf
4343

44+
unless $manage_policy_rc_d =~ Undef {
45+
deprecation('manage_policy_rc_d', 'The manage_policy_rc_d parameter is deprecated and unused. It will be removed in a future version.')
46+
}
47+
4448
Class['openldap::server::install']
4549
-> Class['openldap::server::config']
4650
~> Class['openldap::server::service']

manifests/server/install.pp

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,17 @@
55
contain openldap::utils
66

77
if $facts['os']['family'] == 'Debian' {
8-
if $openldap::server::manage_policy_rc_d {
9-
$policy_rc_d = @(POLICY)
10-
#!/bin/sh
11-
if [ "$1" = "slapd" ]; then
12-
exit 101
13-
fi
14-
exit 0
15-
| POLICY
16-
file { '/usr/sbin/policy-rc.d':
17-
ensure => 'file',
18-
mode => '0755',
19-
owner => 'root',
20-
group => 'root',
21-
content => $policy_rc_d,
22-
before => Package[$openldap::server::package],
23-
}
8+
# When preseeding request to skip the configuration, the service will not
9+
# start and the installation will return an error. To avoid this, we mask
10+
# the unit. The installer will not attempt to start slapd and the
11+
# installation will succed. The module will then be able to tune slapd
12+
# accoding to the user needs and finally start (and unmak) the service.
13+
exec { 'mask-before-openldap-install':
14+
command => "systemctl mask ${openldap::server::service}",
15+
unless => 'test -x /usr/sbin/slapd',
16+
creates => "/etc/systemd/system/${openldap::server::service}.service",
17+
path => '/bin:/usr/bin',
18+
before => Package[$openldap::server::package],
2419
}
2520
file { '/var/cache/debconf/slapd.preseed':
2621
ensure => file,

0 commit comments

Comments
 (0)