Skip to content

Commit

Permalink
Clean up resource dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
razorsedge authored and Joshua Hoblitt committed Aug 17, 2013
1 parent d78077b commit dddb48a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
9 changes: 6 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,15 @@
}

package {$package_name:
ensure => $pkg_ensure,
} -> service {$service_name:
ensure => $pkg_ensure,
}

service {$service_name:
ensure => $svc_ensure,
enable => $svc_enable,
hasrestart => true,
hasstatus => true,
require => Package[$package_name],
}

file {$config_file:
Expand All @@ -177,7 +181,6 @@
mode => '0644',
content => template('smartd/smartd.conf'),
require => Package[$package_name],
before => Service[$service_name],
notify => Service[$service_name],
}

Expand Down
15 changes: 9 additions & 6 deletions spec/classes/smartd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@
it { should contain_service('smartd').with(
:ensure => 'running',
:enable => true,
:hasrestart => true
:hasstatus => true,
:hasrestart => true,
:require => 'Package[smartmontools]'
)}
it { should contain_file('/etc/smartd.conf').with(
:ensure => 'present',
:owner => 'root',
:group => '0',
:mode => '0644',
:require => 'Package[smartmontools]',
:before => 'Service[smartd]',
:notify => 'Service[smartd]'
)}
it 'should contain File[/etc/smartd.conf] with correct contents' do
Expand All @@ -51,15 +52,16 @@
it { should contain_service('smartd').with(
:ensure => 'running',
:enable => true,
:hasrestart => true
:hasstatus => true,
:hasrestart => true,
:require => 'Package[smartmontools]'
)}
it { should contain_file('/etc/smartd.conf').with(
:ensure => 'present',
:owner => 'root',
:group => '0',
:mode => '0644',
:require => 'Package[smartmontools]',
:before => 'Service[smartd]',
:notify => 'Service[smartd]'
)}
it 'should contain File[/etc/smartd.conf] with correct contents' do
Expand All @@ -84,15 +86,16 @@
it { should contain_service('smartd').with(
:ensure => 'running',
:enable => true,
:hasrestart => true
:hasstatus => true,
:hasrestart => true,
:require => 'Package[smartmontools]'
)}
it { should contain_file('/usr/local/etc/smartd.conf').with(
:ensure => 'present',
:owner => 'root',
:group => '0',
:mode => '0644',
:require => 'Package[smartmontools]',
:before => 'Service[smartd]',
:notify => 'Service[smartd]'
)}
it 'should contain File[/usr/local/etc/smartd.conf] with correct contents' do
Expand Down

0 comments on commit dddb48a

Please sign in to comment.