Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

added AIX support and fixed rspec tests #27

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fixtures:
symlinks:
"ldap": "#{source_dir}"
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
motd: "https://github.com/torian/puppet-motd.git"
concat: "https://github.com/puppetlabs/puppet-concat.git"
4 changes: 1 addition & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

require 'rake'
require 'rspec/core/rake_task'
require 'puppetlabs_spec_helper/rake_tasks'

RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/*/*_spec.rb'
Expand Down
23 changes: 18 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
# - CentOS 5.x / 6.x
# - OpenSuse: 11.x / 12.x
# - OVS: 2.1.1 / 2.1.5 / 2.2.0 / 3.0.2
# - AIX(1): 5.3 / 6.1 / 7.1
#
# 1) the perzl.org openldap package also requires openssl
# so we depend on this package.
#
# === Examples
#
Expand All @@ -38,13 +41,23 @@
#
#
class ldap($ensure = present) {

include stdlib
include ldap::params

package { $ldap::params::package :
ensure => $ensure,
}
case $::osfamily {
'AIX': {

package { $ldap::params::package :
ensure => $ensure,
provider => 'rpm',
source => $ldap::params::package_source,
require => Package['openssl']
}
}
default: {
package { $ldap::params::package :
ensure => $ensure,
}
}
}
}

80 changes: 79 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,89 @@

}

'AIX' : {
$package = [ 'openldap' ]
$package_source = 'http://www.oss4aix.org/download/RPMS/openldap/openldap-2.4.23-0.3.aix5.1.ppc.rpm'

$prefix = '/etc/openldap'
$owner = 'root'
$group = 'system'
$config = 'ldap.conf'
$cacertdir = '/etc/openldap/cacerts'

$server_package = [ 'openldap-servers' ]
$server_package_source = 'http://www.oss4aix.org/download/RPMS/openldap/openldap-servers-2.4.23-0.3.aix5.1.ppc.rpm'
$server_config = 'slapd.conf'
$service = 'ldap'
$server_script = 'ldap'
$server_pattern = 'slapd'
$server_owner = 'root'
$server_group = 'ldap'

$schema_prefix = "${prefix}/schema"
$db_prefix = '/var/lib/ldap'

$module_prefix = '/usr/lib/openldap'

$ssl_prefix = '/etc/openldap/cacerts'
$server_run = '/var/run/slapd'
$schema_base = [ 'core', 'cosine', 'nis', 'inetorgperson', ]
$modules_base = [ 'back_bdb' ]
$index_base = [
'index objectclass eq',
'index entryCSN eq',
'index entryUUID eq',
'index uidNumber eq',
'index gidNumber eq',
'index cn pres,sub,eq',
'index sn pres,sub,eq',
'index uid pres,sub,eq',
'index displayName pres,sub,eq',
]

#
# olcTLS* attributes are not defined here
# because they do have their own behavior
# according to the puppet module parameters
#
# olcTLSCACertificatePath = $ssl_ca
# olcTLSCertificateFile = $ssl_cert
# olcTLSCertificateKeyFile = $ssl_key
#
$cnconfig_default_attrs = [
'olcConfigFile',
'olcConfigDir',
'olcAllows',
'olcAttributeOptions',
'olcAuthzPolicty',
'olcConcurrency',
'olcConnMaxPending',
'olcConnMaxPendingAuth',
'olcGentleHUP',
'olcIdleTimeout',
'olcIndexSubstrIfMaxLen',
'olcIndexSubstrIfMinLen',
'olcIndexSubstrIfAnyLen',
'olcIndexSubstrIfAnyStep',
'olcIndexIntLen',
'olcLocalSSF',
'olcPidFile',
'olcReadOnly',
'olcReverseLookup',
'olcSaslSecProps',
'olcSockbufMaxIncoming',
'olcSockbufMaxIncomingAuth',
'olcTLSVerifyClient',
'olcThreads',
'olcToolThreads',
'olcWriteTimeout',
]
}

default: {
fail("Operating system ${::operatingsystem} not supported")
}

}

}

49 changes: 36 additions & 13 deletions manifests/server/master.pp
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,44 @@
motd::register { 'ldap::server::master': }
}

package { $ldap::params::server_package:
ensure => $ensure
}
case $::osfamily {
'AIX': {
package { $ldap::params::server_package:
ensure => $ensure,
source => $ldap::params::server_package_source,
provider => 'rpm',
require => Package['openssl']
}

service { $ldap::params::service:
ensure => running,
enable => true,
pattern => $ldap::params::server_pattern,
provider => 'init',
require => [
Package[$ldap::params::server_package],
File["${ldap::params::prefix}/${ldap::params::server_config}"],
]
}
}
default : {
package { $ldap::params::server_package:
ensure => $ensure
}

service { $ldap::params::service:
ensure => running,
enable => true,
pattern => $ldap::params::server_pattern,
require => [
Package[$ldap::params::server_package],
File["${ldap::params::prefix}/${ldap::params::server_config}"],
]
service { $ldap::params::service:
ensure => running,
enable => true,
pattern => $ldap::params::server_pattern,
require => [
Package[$ldap::params::server_package],
File["${ldap::params::prefix}/${ldap::params::server_config}"],
]
}
}
}


if (!empty($cnconfig_attrs)) {

$cnconfig_default_attrs = $ldap::params::cnconfig_default_attrs
Expand Down Expand Up @@ -245,7 +269,7 @@

# Additional configurations (for rc scripts)
case $::osfamily {

'Debian' : {
class { 'ldap::server::debian': ssl => $ssl }
}
Expand All @@ -261,4 +285,3 @@
}

}

34 changes: 25 additions & 9 deletions manifests/server/slave.pp
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,30 @@
ensure => $ensure
}

service { $ldap::params::service:
ensure => running,
enable => true,
pattern => $ldap::params::server_pattern,
require => [
Package[$ldap::params::server_package],
File["${ldap::params::prefix}/${ldap::params::server_config}"],
]
case $::osfamily {
'AIX': {
service { $ldap::params::service:
ensure => running,
enable => true,
pattern => $ldap::params::server_pattern,
provider => 'init',
require => [
Package[$ldap::params::server_package],
File["${ldap::params::prefix}/${ldap::params::server_config}"],
]
}
}
default : {
service { $ldap::params::service:
ensure => running,
enable => true,
pattern => $ldap::params::server_pattern,
require => [
Package[$ldap::params::server_package],
File["${ldap::params::prefix}/${ldap::params::server_config}"],
]
}
}
}


Expand Down Expand Up @@ -298,7 +314,7 @@

# Additional configurations (for rc scripts)
case $::osfamily {

'Debian' : {
class { 'ldap::server::debian': ssl => $ssl }
}
Expand Down
98 changes: 48 additions & 50 deletions spec/classes/ldap_client_spec.rb
Original file line number Diff line number Diff line change
@@ -1,66 +1,64 @@

require 'spec_helper'

oses = @oses

describe 'ldap::client' do

oses.keys.each do |os|

describe "Running on #{os}" do
oses.keys.each do |os|

let(:facts) { {
:osfamily => oses[os][:osfamily],
:operatingsystem => oses[os][:operatingsystem],
:operatingsystemmajrelease => oses[os][:operatingsystemmajrelease],
:architecture => oses[os][:architecture],
} }
describe "Running on #{os}" do

let(:params) { {
:uri => 'ldap://ldap.example.com',
:base => 'dc=suffix',
} }

it { should include_class('ldap::params') }
it { should contain_file(oses[os][:utils_cfg]) }
let(:facts) { {
:osfamily => oses[os][:osfamily],
:operatingsystem => oses[os][:operatingsystem],
:operatingsystemmajrelease => oses[os][:operatingsystemmajrelease],
:architecture => oses[os][:architecture],
:concat_basedir => oses[os][:concat_basedir],
} }

context 'Motd disabled (default)' do
it { should_not contain_motd__register('ldap') }
end
context 'Motd enabled' do
let(:params) { {
:uri => 'ldap://ldap.example.com',
:base => 'dc=suffix',
:enable_motd => true
} }
it { should contain_motd__register('ldap') }
end
let(:params) { {
:uri => 'ldap://ldap.example.com',
:base => 'dc=suffix',
} }

context 'SSL Enabled with certificate filename' do
let(:params) { {
:uri => 'ldap://ldap.example.com',
:base => 'dc=suffix',
:ssl => true,
:ssl_cert => oses[os][:ssl_cert],
} }
it { should contain_file("#{oses[os][:cacertdir]}/#{oses[os][:ssl_cert]}") }
end
it { should contain_class('ldap::params') }
it { should contain_file(oses[os][:utils_cfg]) }

context 'SSL Enabled without certificate' do
let(:params) { {
:uri => 'ldap://ldap.example.com',
:base => 'dc=suffix',
:ssl => true,
} }
it { expect {
should contain_file("#{oses[os][:cacertdir]}/#{oses[os][:ssl_cert]}")
}.to raise_error(Puppet::Error, /^When ssl is.*/)
}
context 'Motd disabled (default)' do
it { should_not contain_motd__register('ldap') }
end

end
context 'Motd enabled' do
let(:params) { {
:uri => 'ldap://ldap.example.com',
:base => 'dc=suffix',
:enable_motd => true
} }
it { should contain_motd__register('ldap') }
end

end
context 'SSL Enabled with certificate filename' do
let(:params) { {
:uri => 'ldap://ldap.example.com',
:base => 'dc=suffix',
:ssl => true,
:ssl_cert => oses[os][:ssl_cert],
} }
it { should contain_file("#{oses[os][:cacertdir]}/#{oses[os][:ssl_cert]}") }
end

end
context 'SSL Enabled without certificate' do
let(:params) { {
:uri => 'ldap://ldap.example.com',
:base => 'dc=suffix',
:ssl => true,
} }
it { expect {
should contain_file("#{oses[os][:cacertdir]}/#{oses[os][:ssl_cert]}")
}.to raise_error(Puppet::Error, /^When ssl is.*/)
}
end

end
end
end
Loading