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

Manage nsswitch #149

Merged
merged 3 commits into from
Oct 21, 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ doc/
# Vim
*.swp

# Eclipse
.project

# OS X
.DS_Store

Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ env:
- PUPPET_GEM_VERSION="~> 4.4.0"
- PUPPET_GEM_VERSION="~> 4.5.0"
- PUPPET_GEM_VERSION="~> 4.6.0"
- PUPPET_GEM_VERSION="~> 4.7.0"
- PUPPET_GEM_VERSION="~> 4"

sudo: false
Expand Down Expand Up @@ -59,6 +60,8 @@ matrix:
env: PUPPET_GEM_VERSION="~> 4.5.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.6.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.7.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4"
- rvm: 2.3.1
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@ Boolean to purge the limits.d directory.

- *Default*: false

manage_nsswitch
------------------
Boolean to manage the inclusion of the nsswitch class.

- *Default*: true

===

# pam::limits::fragment define
Expand Down
11 changes: 10 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,18 @@
$system_auth_ac_password_lines = undef,
$system_auth_ac_session_lines = undef,
$vas_major_version = '4',
$manage_nsswitch = true,
) {

include ::nsswitch
if is_string($manage_nsswitch) == true {
$manage_nsswitch_real = str2bool($manage_nsswitch)
} else {
$manage_nsswitch_real = $manage_nsswitch
}

if $manage_nsswitch_real == true {
include ::nsswitch
}

case $::osfamily {
'RedHat': {
Expand Down
36 changes: 36 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,42 @@
end
end

context "with manage_nsswitch parameter default value" do
let :facts do
{ :osfamily => v[:osfamily],
:"#{v[:releasetype]}" => v[:release],
:lsbdistid => v[:lsbdistid],
}
end
it { is_expected.to contain_class('nsswitch') }
end

['true', true, 'y'].each do |value|
context "with manage_nsswitch parameter set to #{value}" do
let :facts do
{ :osfamily => v[:osfamily],
:"#{v[:releasetype]}" => v[:release],
:lsbdistid => v[:lsbdistid],
}
end
let(:params) { {:manage_nsswitch => value} }
it { is_expected.to contain_class('nsswitch') }
end
end

['false', false, 'n'].each do |value|
context "with manage_nsswitch parameter set to #{value}" do
let :facts do
{ :osfamily => v[:osfamily],
:"#{v[:releasetype]}" => v[:release],
:lsbdistid => v[:lsbdistid],
}
end
let(:params) { {:manage_nsswitch => value} }
it { is_expected.not_to contain_class('nsswitch') }
end
end

['true',true,'false',false].each do |value|
context "with limits_fragments_hiera_merge parameter specified as a valid value: #{value} on #{v[:osfamily]} with #{v[:releasetype]} #{v[:release]}" do
let :facts do
Expand Down