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 sssd_package_ensure parameter #24

Merged
merged 1 commit into from
Oct 20, 2016
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
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# Name of the sssd package. Only set this if your patform is not supported or
# you know what you're doing.
#
# [*sssd_package_ensure*]
# Sets the ensure parameter of the sssd package.
#
# [*extra_packages*]
# Array with extra packages to be installed
#
Expand Down Expand Up @@ -73,6 +76,7 @@
$ensure = $sssd::params::ensure,
$config = $sssd::params::config,
$sssd_package = $sssd::params::sssd_package,
$sssd_package_ensure = $sssd::params::sssd_package_ensure,
$sssd_service = $sssd::params::sssd_service,
$extra_packages = $sssd::params::extra_packages,
$extra_packages_ensure = $sssd::params::extra_packages_ensure,
Expand All @@ -91,6 +95,7 @@
Allowed values are 'present' and 'absent'.")

validate_string(
$sssd_package_ensure,
$sssd_package,
$sssd_service,
$config_template
Expand Down
4 changes: 2 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# See README.md for usage information
class sssd::install (
$ensure = $sssd::ensure,
$sssd_package = $sssd::sssd_package,
$sssd_package_ensure = $sssd::sssd_package_ensure,
$extra_packages = $sssd::extra_packages,
$extra_packages_ensure = $sssd::extra_packages_ensure,
) {

package { $sssd_package:
ensure => $ensure,
ensure => $sssd_package_ensure,
}

if $extra_packages {
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
$config_template = "${module_name}/sssd.conf.sorted.erb"
}

$sssd_package_ensure = 'present'

case $::osfamily {

'RedHat': {
Expand Down
24 changes: 24 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
it { is_expected.to contain_exec('authconfig-mkhomedir').that_comes_before('File[sssd.conf]') }

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
Expand All @@ -49,6 +50,11 @@
.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 RedHat 6.6' do
let(:facts) do
Expand Down Expand Up @@ -77,6 +83,7 @@
it { is_expected.to contain_exec('authconfig-mkhomedir').that_comes_before('File[sssd.conf]') }

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

Expand All @@ -101,6 +108,11 @@
.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 RedHat 7.1' do
let(:facts) do
Expand Down Expand Up @@ -129,6 +141,7 @@
it { is_expected.to contain_exec('authconfig-mkhomedir').that_comes_before('File[sssd.conf]') }

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

Expand All @@ -153,6 +166,11 @@
.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 Debian 8.1' do
let(:facts) do
Expand Down Expand Up @@ -181,6 +199,7 @@
it { is_expected.not_to contain_service('oddjobd') }

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
Expand All @@ -203,5 +222,10 @@
.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