Skip to content

Commit 47c82de

Browse files
committed
Restart rsyslog if feature_packages are installed
Setup rsyslog so that if any $feature_packages are given rsyslog will restart after those $feature_packages are installed. Forcing a restart of rsyslog after installation of any $feature_packages are installed is important if you have an rsyslog config that is not valid without the additional package from $feature_packages in place.
1 parent dfec146 commit 47c82de

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

manifests/base.pp

+9-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@
2828
}
2929
}
3030

31-
if $rsyslog::feature_packages {
32-
package { $rsyslog::feature_packages:
33-
ensure => installed,
34-
require => Package[$rsyslog::package_name],
35-
}
31+
$feature_packages_parms = $rsyslog::manage_service ? {
32+
true => { 'notify' => Service[$rsyslog::service_name], },
33+
default => {},
34+
}
35+
36+
package { $rsyslog::feature_packages:
37+
ensure => installed,
38+
require => Package[$rsyslog::package_name],
39+
* => $feature_packages_parms,
3640
}
3741

3842
if $rsyslog::manage_confdir {

spec/classes/init_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
context 'with feature packages' do
3030
let(:params) { { 'feature_packages' => %w[rsyslog-relp rsyslog-mmnormalize rsyslog-gnutls] } }
3131

32-
it { is_expected.to contain_package('rsyslog-relp').with_ensure('installed') }
33-
it { is_expected.to contain_package('rsyslog-mmnormalize').with_ensure('installed') }
34-
it { is_expected.to contain_package('rsyslog-gnutls').with_ensure('installed') }
32+
it { is_expected.to contain_package('rsyslog-relp').with_ensure('installed').that_notifies('Service[rsyslog]') }
33+
it { is_expected.to contain_package('rsyslog-mmnormalize').with_ensure('installed').that_notifies('Service[rsyslog]') }
34+
it { is_expected.to contain_package('rsyslog-gnutls').with_ensure('installed').that_notifies('Service[rsyslog]') }
3535
end
3636

3737
context "with upstream packages enabled on #{facts[:os]['name']}" do # rubocop:disable RSpec/EmptyExampleGroup

0 commit comments

Comments
 (0)