Skip to content

Commit

Permalink
Merge pull request #149 from ghoneycutt/manage_nsswitch
Browse files Browse the repository at this point in the history
Manage nsswitch
  • Loading branch information
ghoneycutt authored Oct 21, 2016
2 parents f6df615 + f3c9f54 commit 9ab79dc
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
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

0 comments on commit 9ab79dc

Please sign in to comment.