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

MODULES-10586 Centos 8: wrong package used to install mod_authnz_ldap #2021

Merged
merged 3 commits into from
Jun 29, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
'auth_openidc' => 'mod_auth_openidc',
'authnz_ldap' => $::apache::version::distrelease ? {
'7' => 'mod_ldap',
'8' => 'mod_ldap',
default => 'mod_authz_ldap',
},
'authnz_pam' => 'mod_authnz_pam',
Expand Down
38 changes: 38 additions & 0 deletions spec/acceptance/mod_authnz_ldap_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require 'spec_helper_acceptance'
apache_hash = apache_settings_hash

# We need to restrict this test to RHEL 7.x, 8.x derived OSs as there are too many unique
# dependency issues to solve on all supported platforms.
describe 'apache::mod_authnz_ldap', if: os[:family] == 'redhat' && os[:release].to_i > 6 do
context 'Default mod_authnz_ldap module installation' do
pp = if run_shell("grep 'Oracle Linux Server' /etc/os-release", expect_failures: true).exit_status == 0
<<-MANIFEST
yumrepo { 'ol7_optional_latest':
name => 'ol7_optional_latest',
baseurl => 'https://yum.oracle.com/repo/OracleLinux/OL7/optional/latest/x86_64/',
gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle',
gpgcheck => 1,
enabled => 1,
}
class { 'apache': }
class { 'apache::mod::authnz_ldap': }
MANIFEST
else
<<-MANIFEST
package { 'epel-release':
ensure => present,
}
class { 'apache': }
class { 'apache::mod::authnz_ldap': }
MANIFEST
end

it 'succeeds in installing the mod_authnz_ldap module' do
apply_manifest(pp, catch_failures: true)
end

describe file("#{apache_hash['mod_dir']}/authnz_ldap.load") do
it { is_expected.to contain 'mod_authnz_ldap.so' }
end
end
end
89 changes: 46 additions & 43 deletions spec/classes/mod/authnz_ldap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,50 +41,53 @@
end # Debian

context 'default configuration with parameters on a RedHat OS' do
let :facts do
{
osfamily: 'RedHat',
operatingsystemrelease: '6',
id: 'root',
kernel: 'Linux',
operatingsystem: 'RedHat',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
is_pe: false,
}
end

it { is_expected.to contain_class('apache::params') }
it { is_expected.to contain_class('apache::mod::ldap') }
it { is_expected.to contain_apache__mod('authnz_ldap') }

context 'default verify_server_cert' do
it { is_expected.to contain_file('authnz_ldap.conf').with_content(%r{^LDAPVerifyServerCert On$}) }
end

context 'verify_server_cert = false' do
let(:params) { { verify_server_cert: false } }

it { is_expected.to contain_file('authnz_ldap.conf').with_content(%r{^LDAPVerifyServerCert Off$}) }
end

context 'verify_server_cert = wrong' do
let(:params) { { verify_server_cert: 'wrong' } }

it 'raises an error' do
expect { is_expected.to raise_error Puppet::Error }
on_supported_os.each do |os, os_facts|
next unless os.start_with?('redhat')
context "On #{os}" do
let :facts do
os_facts
end

it { is_expected.to contain_class('apache::params') }
it { is_expected.to contain_class('apache::mod::ldap') }
it { is_expected.to contain_apache__mod('authnz_ldap') }

if os_facts[:operatingsystemmajrelease].to_i >= 7
it { is_expected.to contain_package('mod_ldap') }
else
it { is_expected.to contain_package('mod_authz_ldap') }
end

context 'default verify_server_cert' do
it { is_expected.to contain_file('authnz_ldap.conf').with_content(%r{^LDAPVerifyServerCert On$}) }
end

context 'verify_server_cert = false' do
let(:params) { { verify_server_cert: false } }

it { is_expected.to contain_file('authnz_ldap.conf').with_content(%r{^LDAPVerifyServerCert Off$}) }
end

context 'verify_server_cert = wrong' do
let(:params) { { verify_server_cert: 'wrong' } }

it 'raises an error' do
expect { is_expected.to raise_error Puppet::Error }
sanfrancrisko marked this conversation as resolved.
Show resolved Hide resolved
end
end

context 'SCL', if: (os_facts[:operatingsystemmajrelease].to_i >= 6 && os_facts[:operatingsystemmajrelease].to_i < 8) do
let(:pre_condition) do
"class { 'apache::version':
scl_httpd_version => '2.4',
scl_php_version => '7.0',
}
include apache"
end

it { is_expected.to contain_package('httpd24-mod_ldap') }
end
end
end

context 'SCL' do
let(:pre_condition) do
"class { 'apache::version':
scl_httpd_version => '2.4',
scl_php_version => '7.0',
}
include apache"
end

it { is_expected.to contain_package('httpd24-mod_ldap') }
end
end # Redhat
end