Skip to content

Commit

Permalink
Merge pull request #44 from liv3d/fix_groups
Browse files Browse the repository at this point in the history
Fix default group for FreeBSD
  • Loading branch information
Joshua Hoblitt committed Sep 25, 2015
2 parents 7ed901e + 2f976f1 commit 6802d4f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
file { $config_file:
ensure => $file_ensure,
owner => 'root',
group => 'root',
group => $::gid,
mode => '0644',
content => template('smartd/smartd.conf'),
require => Package[$package_name],
Expand Down
27 changes: 17 additions & 10 deletions spec/unit/classes/smartd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@
config_file = '/etc/smartd.conf'
end

group = nil
if values && values[:group]
group = values[:group]
else
group = 'root'
end

it { should contain_package('smartmontools').with_ensure('present') }
it do
should contain_file(config_file).with({
:ensure => 'present',
:owner => 'root',
:group => 'root',
:group => group,
:mode => '0644',
})
end
Expand All @@ -36,7 +43,7 @@

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

it_behaves_like 'default', {}
it { should_not contain_shell_config('start_smartd') }
Expand All @@ -47,7 +54,7 @@
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' }}
let(:facts) {{ :osfamily => 'RedHat', :operatingsystem => 'RedHat', :operatingsystemmajrelease => '6', :smartmontools_version => '5.43', :gid => 'root' }}

it_behaves_like 'default', {}
it { should_not contain_shell_config('start_smartd') }
Expand All @@ -56,7 +63,7 @@
end

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

it_behaves_like 'default', { :config_file => '/etc/smartmontools/smartd.conf' }
it { should_not contain_shell_config('start_smartd') }
Expand All @@ -67,7 +74,7 @@

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

it_behaves_like 'default', {}
it { should_not contain_shell_config('start_smartd') }
Expand All @@ -76,7 +83,7 @@
end

describe 'for operatingsystemrelease 19' do
let(:facts) {{ :osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '19', :smartmontools_version => '6.1' }}
let(:facts) {{ :osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '19', :smartmontools_version => '6.1', :gid => 'root' }}

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

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

it_behaves_like 'default', {}
it { should contain_shell_config('start_smartd') }
Expand All @@ -96,9 +103,9 @@
end

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

it_behaves_like 'default', { :config_file => '/usr/local/etc/smartd.conf' }
it_behaves_like 'default', { :config_file => '/usr/local/etc/smartd.conf', :group => 'wheel' }
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]') }
Expand Down Expand Up @@ -556,7 +563,7 @@
:devices => [{ 'device' => 'megaraid', 'options' => '-I 194' }],
}
end

it do
should contain_class('smartd')
should contain_class('smartd::params')
Expand Down

0 comments on commit 6802d4f

Please sign in to comment.