Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework default database lifecycle on Debian #372

Merged
merged 4 commits into from Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions manifests/server.pp
@@ -1,4 +1,7 @@
# See README.md for details.
# @param manage_policy_rc_d
# If set, manage /usr/sbin/policy-rc.d on Debian based operating systems to not automatically start the LDAP server
# when installing slapd. This is required when preseeding the package with the no_configuration flag as we have to.
class openldap::server (
String[1] $package,
String[1] $confdir,
Expand Down Expand Up @@ -30,6 +33,7 @@
Optional[Stdlib::Absolutepath] $krb5_keytab_file = undef,
Optional[String] $ldap_config_backend = undef,
Optional[Boolean] $enable_memory_limit = undef,
Boolean $manage_policy_rc_d = true,
) {
include openldap::server::install
include openldap::server::config
Expand Down
12 changes: 12 additions & 0 deletions manifests/server/config.pp
Expand Up @@ -50,6 +50,18 @@
variable => 'SLAPD_SERVICES',
value => $slapd_ldap_urls,
}

# Debian configuration include database creation. We skip this with
# preseeding files so we need to manualy bootstrap cn=config (but not the
# databases).
exec { 'bootstrap cn=config':
command => "/bin/sed -e 's/@BACKEND@/mdb/g' -e '/^# The database definition.$/q' /usr/share/slapd/slapd.init.ldif | /usr/sbin/slapadd -F ${openldap::server::confdir} -b cn=config",
provider => 'shell',
creates => "${openldap::server::confdir}/cn=config.ldif",
user => $openldap::server::owner,
group => $openldap::server::group,
require => File[$openldap::server::confdir],
}
}
'RedHat': {
if versioncmp($facts['os']['release']['major'], '6') <= 0 {
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/database.pp
Expand Up @@ -49,7 +49,7 @@
Class['openldap::server::service']
-> Openldap::Server::Database[$title]
-> Class['openldap::server']
if $title != 'dc=my-domain,dc=com' and fact('os.family') == 'Debian' {
if $title != 'dc=my-domain,dc=com' and fact('os.family') == 'RedHat' {
Openldap::Server::Database['dc=my-domain,dc=com'] -> Openldap::Server::Database[$title]
}

Expand Down
19 changes: 18 additions & 1 deletion manifests/server/install.pp
Expand Up @@ -5,12 +5,29 @@
contain openldap::utils

if $facts['os']['family'] == 'Debian' {
if $openldap::server::manage_policy_rc_d {
$policy_rc_d = @(POLICY)
#!/bin/sh
if [ "$1" = "slapd" ]; then
exit 101
fi
exit 0
| POLICY
file { '/usr/sbin/policy-rc.d':
ensure => 'file',
mode => '0755',
owner => 'root',
group => 'root',
content => $policy_rc_d,
before => Package[$openldap::server::package],
}
}
file { '/var/cache/debconf/slapd.preseed':
ensure => file,
mode => '0644',
owner => 'root',
group => 'root',
content => "slapd slapd/domain\tstring\tmy-domain.com\n",
content => "slapd slapd/no_configuration\tboolean\ttrue\n",
before => Package[$openldap::server::package],
}
$responsefile = '/var/cache/debconf/slapd.preseed'
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/slapdconf.pp
Expand Up @@ -22,7 +22,7 @@
fail 'You must specify a ssl_cert'
}

if $facts['os']['family'] == 'Debian' or $facts['os']['family'] == 'RedHat' {
if $facts['os']['family'] == 'RedHat' {
openldap::server::database { 'dc=my-domain,dc=com':
ensure => absent,
}
Expand Down
35 changes: 31 additions & 4 deletions spec/acceptance/db_spec.rb
Expand Up @@ -36,12 +36,22 @@
end

context 'without parameters' do
it 'creates a database' do
pp = <<-EOS
class { 'openldap::server': }
openldap::server::database { 'dc=foo,dc=com': }
let(:datadir) { '/var/lib/ldap' }
let(:user) do
if fact('os.family') == 'Debian'
'openldap'
else
'ldap'
end
end
let(:pp) do
<<-EOS
class { 'openldap::server': }
openldap::server::database { 'dc=foo,dc=com': }
EOS
end

it 'creates a database' do
idempotent_apply(pp)
end

Expand All @@ -50,6 +60,23 @@
expect(r.stdout).to match(%r{dn: dc=foo,dc=com})
end
end

it 'can dump the database' do
on default, 'slapcat -l /tmp/data.ldif'
end

it 'can restore the database' do
on default, puppet('resource service slapd ensure=stopped')
on default, "rm -r #{datadir}"
on default, "mkdir #{datadir}"
on default, 'slapadd -l /tmp/data.ldif'
on default, "chown -R #{user}:#{user} #{datadir}"
on default, puppet('resource service slapd ensure=running')
end

it 'has no change' do
apply_manifest(pp, catch_changes: true)
end
end

context 'with a directory' do
Expand Down Expand Up @@ -116,7 +143,7 @@
end

context 'with a ldap db' do
it 'creates a ldap database' do

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - Debian 10

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'debian10-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194109802.pp.ZDEHm1 Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for debian10-64-puppet7.example.com in environment production in 0.18 seconds Info: Using environment 'production' Info: Applying configuration version '1681414872' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 1.03 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - Debian 10

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'debian10-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194131832.pp.oCVxAK Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for debian10-64-puppet6.example.com in environment production in 0.27 seconds Info: Using environment 'production' Info: Applying configuration version '1681414894' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 1.17 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - Debian 11

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'debian11-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194046300.pp.kAH1Ay Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for debian11-64-puppet7.example.com in environment production in 0.15 seconds Info: Using environment 'production' Info: Applying configuration version '1681414848' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 0.76 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - Debian 11

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'debian11-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194046385.pp.RDOKDR Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for debian11-64-puppet6.example.com in environment production in 0.19 seconds Info: Using environment 'production' Info: Applying configuration version '1681414848' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 0.73 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - Ubuntu 18.04

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'ubuntu1804-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194109334.pp.geeZa1 Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for ubuntu1804-64-puppet7.example.com in environment production in 0.15 seconds Info: Using environment 'production' Info: Applying configuration version '1681414871' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 1.38 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - Ubuntu 18.04

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'ubuntu1804-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194120952.pp.abisoD Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for ubuntu1804-64-puppet6.example.com in environment production in 0.26 seconds Info: Using environment 'production' Info: Applying configuration version '1681414883' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 1.56 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - Ubuntu 20.04

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'ubuntu2004-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194204323.pp.sSiUP1 Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for ubuntu2004-64-puppet7.example.com in environment production in 0.21 seconds Info: Using environment 'production' Info: Applying configuration version '1681414927' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 1.69 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - Ubuntu 20.04

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'ubuntu2004-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194118266.pp.iETS1O Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for ubuntu2004-64-puppet6.example.com in environment production in 0.25 seconds Info: Using environment 'production' Info: Applying configuration version '1681414880' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 1.28 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - Ubuntu 22.04

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'ubuntu2204-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194112642.pp.Ap2uvy Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for ubuntu2204-64-puppet7.example.com in environment production in 0.17 seconds Info: Using environment 'production' Info: Applying configuration version '1681414875' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 1.13 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - Ubuntu 22.04

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'ubuntu2204-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194126251.pp.78PhCW Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for ubuntu2204-64-puppet6.example.com in environment production in 0.25 seconds Info: Using environment 'production' Info: Applying configuration version '1681414889' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 1.28 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - AlmaLinux 8

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'almalinux8-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194040864.pp.4hyLiP Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for almalinux8-64-puppet7.example.com in environment production in 0.20 seconds Info: Using environment 'production' Info: Applying configuration version '1681414842' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'hdb' to 'ldap' �[mNotice: Applied catalog in 0.21 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - AlmaLinux 8

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'almalinux8-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194131760.pp.xeaTbQ Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for almalinux8-64-puppet6.example.com in environment production in 0.46 seconds Info: Using environment 'production' Info: Applying configuration version '1681414894' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'hdb' to 'ldap' �[mNotice: Applied catalog in 0.34 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - AlmaLinux 9

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'almalinux9-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194026820.pp.uFhUPg Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for almalinux9-64-puppet7.example.com in environment production in 0.26 seconds Info: Using environment 'production' Info: Applying configuration version '1681414828' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 0.25 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - AlmaLinux 9

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'almalinux9-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194033173.pp.0cV50Q Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for almalinux9-64-puppet6.example.com in environment production in 0.33 seconds Info: Using environment 'production' Info: Applying configuration version '1681414835' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 0.26 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - Rocky 8

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'rocky8-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194112719.pp.D7cIXZ Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for rocky8-64-puppet7.example.com in environment production in 0.30 seconds Info: Using environment 'production' Info: Applying configuration version '1681414875' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'hdb' to 'ldap' �[mNotice: Applied catalog in 0.27 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - Rocky 8

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'rocky8-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194115177.pp.AJbChR Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for rocky8-64-puppet6.example.com in environment production in 0.32 seconds Info: Using environment 'production' Info: Applying configuration version '1681414877' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'hdb' to 'ldap' �[mNotice: Applied catalog in 0.30 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - Rocky 9

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'rocky9-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194123817.pp.qZNFqU Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for rocky9-64-puppet7.example.com in environment production in 0.30 seconds Info: Using environment 'production' Info: Applying configuration version '1681414886' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 0.28 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - Rocky 9

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'rocky9-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194106146.pp.MgepVG Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for rocky9-64-puppet6.example.com in environment production in 0.49 seconds Info: Using environment 'production' Info: Applying configuration version '1681414868' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 0.33 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - CentOS 7

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'centos7-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194056139.pp.U8HJVN Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for centos7-64-puppet7.example.com in environment production in 0.13 seconds Info: Using environment 'production' Info: Applying configuration version '1681414858' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'hdb' to 'ldap' �[mNotice: Applied catalog in 0.18 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - CentOS 7

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'centos7-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194118942.pp.ofnxha Last 10 lines of output were: 2023-04-13 19:41:20.017468 WARN puppetlabs.facter - locale environment variables were bad; continuing with LANG=C LC_ALL=C Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for centos7-64-puppet6.example.com in environment production in 0.20 seconds Info: Using environment 'production' Info: Applying configuration version '1681414881' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'hdb' to 'ldap' �[mNotice: Applied catalog in 0.23 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - CentOS 9

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'centos9-64-puppet7.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194103634.pp.A0ZfLQ Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for centos9-64-puppet7.example.com in environment production in 0.26 seconds Info: Using environment 'production' Info: Applying configuration version '1681414865' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 0.24 seconds

Check warning on line 146 in spec/acceptance/db_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 6 - CentOS 9

openldap::server::database with a ldap db creates a ldap database Failure/Error: apply_manifest(pp, catch_changes: true) Beaker::Host::CommandFailure: Host 'centos9-64-puppet6.example.com' exited with 2 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_194057768.pp.PthR3j Last 10 lines of output were: Info: Loading facts Info: Loading facts �[mNotice: Compiled catalog for centos9-64-puppet6.example.com in environment production in 0.35 seconds Info: Using environment 'production' Info: Applying configuration version '1681414859' �[mNotice: /Stage[main]/Main/Openldap::Server::Database[dc=bar,dc=com]/Openldap_database[dc=bar,dc=com]/backend: backend changed 'mdb' to 'ldap' �[mNotice: Applied catalog in 0.25 seconds
pp = <<-EOS
class {'openldap::server': }
openldap::server::module {'back_ldap':
Expand Down
4 changes: 3 additions & 1 deletion spec/acceptance/openldap__server__access_spec.rb
Expand Up @@ -17,7 +17,9 @@ class { 'openldap::server': }
after :all do
pp = <<-EOS
class { 'openldap::server': }
openldap::server::database { 'dc=example,dc=com': ensure => absent, }
openldap::server::database { 'dc=example,dc=com':
ensure => absent,
}
EOS

idempotent_apply(pp)
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/openldap_server_slapdconf_spec.rb
Expand Up @@ -14,7 +14,7 @@
it { is_expected.to contain_class('openldap::server::slapdconf') }

case facts[:osfamily]
when %r{Debian|RedHat}
when 'RedHat'
it { is_expected.to contain_openldap__server__database('dc=my-domain,dc=com').with(ensure: :absent) }
else
it { is_expected.not_to contain_openldap__server__database('dc=my-domain,dc=com').with(ensure: :absent) }
Expand Down
16 changes: 4 additions & 12 deletions spec/classes/openldap_server_spec.rb
Expand Up @@ -2,8 +2,6 @@

require 'spec_helper'

# rubocop:disable Style/IdenticalConditionalBranches
# rubocop:disable RSpec/RepeatedExample
describe 'openldap::server' do
on_supported_os.each do |os, facts|
context "on #{os}" do
Expand Down Expand Up @@ -47,8 +45,7 @@
ssl_ca: nil)
}

it { is_expected.to contain_openldap__server__database('dc=my-domain,dc=com').with(ensure: :absent) }
it { is_expected.to have_openldap__server__database_resource_count(1) }
it { is_expected.to have_openldap__server__database_resource_count(0) }
when 'RedHat'
case facts[:operatingsystemmajrelease]
when '5'
Expand All @@ -61,9 +58,6 @@
ssl_key: nil,
ssl_ca: nil)
}

it { is_expected.to have_openldap__server__database_resource_count(1) }
it { is_expected.to contain_openldap__server__database('dc=my-domain,dc=com').with(ensure: :absent) }
else
it {
is_expected.to contain_class('openldap::server').with(package: 'openldap-servers',
Expand All @@ -74,15 +68,13 @@
ssl_key: nil,
ssl_ca: nil)
}

it { is_expected.to have_openldap__server__database_resource_count(1) }
it { is_expected.to contain_openldap__server__database('dc=my-domain,dc=com').with(ensure: :absent) }
end

it { is_expected.to have_openldap__server__database_resource_count(1) }
it { is_expected.to contain_openldap__server__database('dc=my-domain,dc=com').with(ensure: :absent) }
end
end
end
end
end
end
# rubocop:enable Style/IdenticalConditionalBranches
# rubocop:enable RSpec/RepeatedExample