Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.
Open
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
8 changes: 4 additions & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@
default => 'nagios-plugins',
}

$htpasswdfile = $::operatingsystem ? {
/(?i:Debian|Ubuntu|Mint)/ => '/etc/nagios3/htpasswd.users',
default => '/etc/nagios/htpasswd.users',
$htpasswdfile = $::osfamily ? {
'Debian' => '/etc/nagios3/htpasswd.users',
'RedHat' => '/etc/nagios/passwd',
default => '/etc/nagios/htpasswd.users',
}


### Application related parameters

$package = $::operatingsystem ? {
Expand Down
28 changes: 28 additions & 0 deletions spec/classes/nagios_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,33 @@
end
end

describe 'Test htpasswdfile correct' do
before(:each) do
@htpasswd_resource = catalogue.resource('apache::htpasswd', 'nagiosadmin')
end

context 'on Debian-like systems' do
let(:facts) { { :osfamily => 'Debian' } }

it 'should set the apache htpasswd in the correct file' do
@htpasswd_resource[:htpasswd_file].should eq('/etc/nagios3/htpasswd.users')
end
end

context 'on Redhat-like systems' do
let(:facts) { { :osfamily => 'Redhat' } }

it 'should set the apache htpasswd in the correct file' do
@htpasswd_resource[:htpasswd_file].should eq('/etc/nagios/passwd')
end
end

context 'on non-Redhat and non-Debian systems' do
it 'should set the apache htpasswd in the correct file' do
@htpasswd_resource[:htpasswd_file].should eq('/etc/nagios/htpasswd.users')
end
end
end

end