Skip to content

Commit

Permalink
Merge pull request #37 from razorsedge/fedora_config_location
Browse files Browse the repository at this point in the history
Fedora config location
  • Loading branch information
Joshua Hoblitt committed Sep 2, 2014
2 parents 71acbcc + 293a6b2 commit 7306e3a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
13 changes: 9 additions & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@
}
'RedHat': {
$config_file = $::operatingsystem ? {
'Fedora' => '/etc/smartd.conf',
default => $::operatingsystemmajrelease ? {
'7' => '/etc/smartmontools/smartd.conf',
default => '/etc/smartd.conf',
'Fedora' => $::operatingsystemrelease ? {
# No, I am not going to support versions 1-9.
/10|11|12|13|14|15|16|17|18/ => '/etc/smartd.conf',
default => '/etc/smartmontools/smartd.conf',
},
/RedHat|CentOS|Scientific|SLC|OracleLinux|OEL/ => $::operatingsystemmajrelease ? {
/4|5|6/ => '/etc/smartd.conf',
default => '/etc/smartmontools/smartd.conf',
},
default => '/etc/smartd.conf',
}
$service_name = 'smartd'
}
Expand Down
23 changes: 17 additions & 6 deletions spec/classes/smartd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
end

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

it_behaves_like 'default', { :config_file => '/etc/smartmontools/smartd.conf' }
it { should_not contain_shell_config('start_smartd') }
Expand All @@ -66,12 +66,23 @@
end

describe 'for operatingsystem Fedora' do
let(:facts) {{ :osfamily => 'RedHat', :operatingsystem => 'Fedora', :smartmontools_version => '5.43' }}
describe 'for operatingsystemrelease 18' do
let(:facts) {{ :osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '18', :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]') }
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 operatingsystemrelease 19' do
let(:facts) {{ :osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '19', :smartmontools_version => '6.1' }}

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
end

Expand Down

0 comments on commit 7306e3a

Please sign in to comment.