Skip to content

Commit

Permalink
Merge pull request jhoblitt#34 from solarkennedy/debian_support
Browse files Browse the repository at this point in the history
Added debian support and working tests. Closes jhoblitt#32
  • Loading branch information
Joshua Hoblitt committed Aug 7, 2014
2 parents 962c878 + 5554213 commit 2689cb1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
9 changes: 7 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
class smartd::params {
$package_name = 'smartmontools'
$service_name = 'smartd'
$service_ensure = 'running'
$devicescan = true
$devicescan_options = undef
Expand All @@ -33,9 +32,15 @@
case $::osfamily {
'FreeBSD': {
$config_file = '/usr/local/etc/smartd.conf'
$service_name = 'smartd'
}
'Debian', 'RedHat', 'SuSE': {
'RedHat', 'SuSE': {
$config_file = '/etc/smartd.conf'
$service_name = 'smartd'
}
'Debian': {
$config_file = '/etc/smartd.conf'
$service_name = 'smartmontools'
}
default: {
fail("Module ${module_name} is not supported on ${::operatingsystem}")
Expand Down
15 changes: 6 additions & 9 deletions spec/classes/smartd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,12 @@
end

it { should contain_package('smartmontools').with_ensure('present') }
it do
should contain_service('smartd').with({
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
})
end
it do
should contain_file(config_file).with({
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0644',
:notify => 'Service[smartd]'
})
end
it "should contain File[#{config_file}] with correct contents" do
Expand All @@ -49,20 +40,26 @@

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 Debian' do
let(:facts) {{ :osfamily => 'Debian', :smartmontools_version => '5.43' }}

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

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

it_behaves_like 'default', { :config_file => '/usr/local/etc/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('/usr/local/etc/smartd.conf').with_notify('Service[smartd]') }
end

end
Expand Down

0 comments on commit 2689cb1

Please sign in to comment.