Skip to content

Commit

Permalink
Add in support for EL 7 new config location.
Browse files Browse the repository at this point in the history
EL 7 now puts the smartd.conf in /etc/smartmontools.
  • Loading branch information
razorsedge committed Sep 1, 2014
1 parent a29b3e6 commit 399ac1a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
12 changes: 11 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@
$config_file = '/usr/local/etc/smartd.conf'
$service_name = 'smartd'
}
'RedHat', 'SuSE': {
'RedHat': {
$config_file = $::operatingsystem ? {
'Fedora' => '/etc/smartd.conf',
default => $::operatingsystemmajrelease ? {
'7' => '/etc/smartmontools/smartd.conf',
default => '/etc/smartd.conf',
},
}
$service_name = 'smartd'
}
'SuSE': {
$config_file = '/etc/smartd.conf'
$service_name = 'smartd'
}
Expand Down
35 changes: 33 additions & 2 deletions spec/classes/smartd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,46 @@
end

describe 'on a supported osfamily, default parameters' do
describe 'for osfamily RedHat' do
let(:facts) {{ :osfamily => 'RedHat', :smartmontools_version => '5.43' }}
describe 'for osfamily SuSE' do
let(:facts) {{ :osfamily => 'SuSE', :smartmontools_version => '5.43' }}

it_behaves_like 'default', {}
it { should_not contain_shell_config('start_smartd') }
it { should contain_service('smartd').with_ensure('running').with_enable(true) }
it { should contain_file('/etc/smartd.conf').with_notify('Service[smartd]') }
end

describe 'for osfamily RedHat' do
describe 'for operatingsystem RedHat' do
describe 'for operatingsystemmajrelease 6' do
let(:facts) {{ :osfamily => 'RedHat', :operatingsystem => 'RedHat', :operatingsystemmajrelease => '6', :smartmontools_version => '5.43' }}

it_behaves_like 'default', {}
it { should_not contain_shell_config('start_smartd') }
it { should contain_service('smartd').with_ensure('running').with_enable(true) }
it { should contain_file('/etc/smartd.conf').with_notify('Service[smartd]') }
end

describe 'for operatingsystemmajrelease 7' do
let(:facts) {{ :osfamily => 'RedHat', :operatingsystem => 'RedHat', :operatingsystemmajrelease => '7', :smartmontools_version => '5.43' }}

it_behaves_like 'default', { :config_file => '/etc/smartmontools/smartd.conf' }
it { should_not contain_shell_config('start_smartd') }
it { should contain_service('smartd').with_ensure('running').with_enable(true) }
it { should contain_file('/etc/smartmontools/smartd.conf').with_notify('Service[smartd]') }
end
end

describe 'for operatingsystem Fedora' do
let(:facts) {{ :osfamily => 'RedHat', :operatingsystem => 'Fedora', :smartmontools_version => '5.43' }}

it_behaves_like 'default', {}
it { should_not contain_shell_config('start_smartd') }
it { should contain_service('smartd').with_ensure('running').with_enable(true) }
it { should contain_file('/etc/smartd.conf').with_notify('Service[smartd]') }
end
end

describe 'for osfamily Debian' do
let(:facts) {{ :osfamily => 'Debian', :smartmontools_version => '5.43' }}

Expand Down

0 comments on commit 399ac1a

Please sign in to comment.