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

Add Suse 11.3, 11.4 and 12.x support #45

Merged
merged 1 commit into from
Sep 8, 2017
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:
- PUPPET_GEM_VERSION="~> 4.7.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.8.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.9.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.10.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4" CHECK=test

sudo: false
Expand Down
19 changes: 19 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@

}

'Suse': {
$pamconfig_mkhomedir_check_cmd = '/usr/sbin/pam-config -q --mkhomedir | grep session:'
$pamconfig_check_cmd = '/usr/sbin/pam-config -q --sss | grep session:'

if $mkhomedir {

exec { 'pam-config -a --mkhomedir':
path => '/bin:/usr/bin:/sbin:/usr/sbin',
unless => $pamconfig_mkhomedir_check_cmd,
}
}

exec { 'pam-config -a --sss':
path => '/bin:/usr/bin:/sbin:/usr/sbin',
unless => $pamconfig_check_cmd,
}

}

default: { }

}
Expand Down
43 changes: 43 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,50 @@
]
$extra_packages_ensure = 'present'
$manage_oddjobd = false
}

'Suse': {

$sssd_package = 'sssd'
$sssd_service = 'sssd'
$service_ensure = 'running'
$config_file = '/etc/sssd/sssd.conf'
$mkhomedir = true
#case $::operatingsystemrelease {
case $::operatingsystemmajrelease {
default: {
fail("operatingsystemrelease is <${::operatingsystemmajrelease}> and must be in 11 or 12.")
}
'11': {
case $::operatingsystemrelease {
default: {
fail("operatingsystemrelease is <${::operatingsystemrelease}> and must be in 11.3 or 11.4.")
}
/^11.[34]/: {
$service_dependencies = []
$extra_packages = [
'sssd-32bit',
'sssd-tools',
]
$extra_packages_ensure = 'present'
$manage_oddjobd = false
}
}
}
'12': {
$service_dependencies = []
$extra_packages = [
'sssd-krb5',
'sssd-ad',
'sssd-ipa',
'sssd-32bit',
'sssd-tools',
'sssd-ldap',
]
$extra_packages_ensure = 'present'
$manage_oddjobd = false
}
}
}

default: {
Expand Down
4 changes: 4 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
{
"operatingsystem": "Debian",
"operatingsystemrelease": ["7", "8"]
},
{
"operatingsystem": "Suse",
"operatingsystemrelease": ["11", "12"]
}
],
"requirements": [
Expand Down
118 changes: 118 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,122 @@
it { is_expected.to contain_package('sssd').with_ensure('1.1.1') }
end
end
describe 'on Suse 11.4' do
let(:facts) do
{
:osfamily => 'Suse',
:operatingsystem => 'SLES',
:operatingsystemrelease => '11.4',
:operatingsystemmajrelease => '11',
:rubyversion => '2.1.9',
}
end

context 'with defaults for all parameters' do
it { is_expected.to contain_class('sssd::install') }
it { is_expected.to contain_class('sssd::config') }
it { is_expected.to contain_class('sssd::service') }

it do
is_expected.to contain_file('sssd.conf') \
.with_ensure('present') \
.with_path('/etc/sssd/sssd.conf') \
.with_content(/^# Managed by Puppet.\n\n\[sssd\]/)
end

it { is_expected.to contain_package('sssd-32bit').with_ensure('present') }
it { is_expected.to contain_package('sssd-tools').with_ensure('present') }

it { is_expected.to contain_service('sssd').with_ensure('running') }
it { is_expected.to contain_package('sssd').with_ensure('present') }
end

context 'with service ensure stopped' do
let(:params) { { :service_ensure => 'stopped' } }
it { is_expected.to contain_service('sssd').with_ensure('stopped') }
end

context 'with ruby without ordered hashes' do
let(:facts) do
{
:osfamily => 'Suse',
:operatingsystem => 'SLES',
:operatingsystemrelease => '11.4',
:operatingsystemmajrelease => '11',
:rubyversion => '1.8.7'
}
end
it do
is_expected.to contain_file('sssd.conf') \
.with_ensure('present') \
.with_path('/etc/sssd/sssd.conf') \
.with_content(%r{^# Managed by Puppet.\n\n\[domain/ad.example.com\]})
end
end
context 'with package_ensure set to specific version' do
let(:params) { { :sssd_package_ensure => '1.1.1' } }
it { is_expected.to contain_package('sssd').with_ensure('1.1.1') }
end
end
describe 'on Suse 12.1' do
let(:facts) do
{
:osfamily => 'Suse',
:operatingsystem => 'SLES',
:operatingsystemrelease => '12.1',
:operatingsystemmajrelease => '12',
:rubyversion => '2.1.9',
}
end

context 'with defaults for all parameters' do
it { is_expected.to contain_class('sssd::install') }
it { is_expected.to contain_class('sssd::config') }
it { is_expected.to contain_class('sssd::service') }

it do
is_expected.to contain_file('sssd.conf') \
.with_ensure('present') \
.with_path('/etc/sssd/sssd.conf') \
.with_content(/^# Managed by Puppet.\n\n\[sssd\]/)
end

it { is_expected.to contain_package('sssd-krb5').with_ensure('present') }
it { is_expected.to contain_package('sssd-ad').with_ensure('present') }
it { is_expected.to contain_package('sssd-ipa').with_ensure('present') }
it { is_expected.to contain_package('sssd-32bit').with_ensure('present') }
it { is_expected.to contain_package('sssd-tools').with_ensure('present') }
it { is_expected.to contain_package('sssd-ldap').with_ensure('present') }

it { is_expected.to contain_service('sssd').with_ensure('running') }
it { is_expected.to contain_package('sssd').with_ensure('present') }
end

context 'with service ensure stopped' do
let(:params) { { :service_ensure => 'stopped' } }
it { is_expected.to contain_service('sssd').with_ensure('stopped') }
end

context 'with ruby without ordered hashes' do
let(:facts) do
{
:osfamily => 'Suse',
:operatingsystem => 'SLES',
:operatingsystemrelease => '12.1',
:operatingsystemmajrelease => '12',
:rubyversion => '1.8.7'
}
end
it do
is_expected.to contain_file('sssd.conf') \
.with_ensure('present') \
.with_path('/etc/sssd/sssd.conf') \
.with_content(%r{^# Managed by Puppet.\n\n\[domain/ad.example.com\]})
end
end
context 'with package_ensure set to specific version' do
let(:params) { { :sssd_package_ensure => '1.1.1' } }
it { is_expected.to contain_package('sssd').with_ensure('1.1.1') }
end
end
end