diff --git a/manifests/params.pp b/manifests/params.pp index e2ecce5..3d01387 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,11 +27,21 @@ class nslcd::params { $config = $default_config $package_name = $default_package_name $service_name = $default_service_name - $uid = 'nslcd' - $gid = 'nslcd' - $config_user = 'root' - $config_group = 'nslcd' - $config_mode = '0640' + $uid = 'nslcd' + $gid = 'nslcd' + $config_user = 'root' + $config_group = 'nslcd' + $config_mode = '0640' + } + RedHat: { + $config = $default_config + $package_name = 'nss-pam-ldapd' + $service_name = $default_service_name + $uid = 'nslcd' + $gid = 'ldap' + $config_user = 'root' + $config_group = 'root' + $config_mode = '0600' } default: { fail("The ${module_name} module is not supported on an ${::osfamily} based system.") diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index bf42e92..d64fefa 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -2,13 +2,14 @@ require 'spec_helper' describe 'nslcd' do - {'Ubuntu' => 'Debian', 'Debian' => 'Debian'}.each do |system, family| + {'Ubuntu' => 'Debian', 'Debian' => 'Debian', 'CentOS' => 'RedHat', 'RedHat' => 'RedHat' }.each do |system, family| context "when on system #{system}" do - let :facts do - { + facts = { :osfamily => family, :operatingsystem => system, - } + } + let :facts do + facts end it { should contain_class('nslcd') } @@ -16,10 +17,19 @@ describe 'nslcd' do it { should contain_class('nslcd::config') } it { should contain_class('nslcd::service') } - it { - should contain_package('nslcd') - should contain_service('nslcd') - } + + case facts[:osfamily] + when 'Debian' + it { + should contain_package('nslcd') + should contain_service('nslcd') + } + when 'RedHat' + it { + should contain_package('nss-pam-ldapd') + should contain_service('nslcd') + } + end end end