Skip to content

Commit

Permalink
Restart rsyslog if feature_packages are installed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bsper2 committed Apr 21, 2022
1 parent dfec146 commit df14a58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
14 changes: 9 additions & 5 deletions manifests/base.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@
}
}

if $rsyslog::feature_packages {
package { $rsyslog::feature_packages:
ensure => installed,
require => Package[$rsyslog::package_name],
}
$feature_packages_parms = $rsyslog::manage_service ? {
true => { 'notify' => Service[$rsyslog::service_name], },
default => {},
}

package { $rsyslog::feature_packages:
ensure => installed,
require => Package[$rsyslog::package_name],
* => $feature_packages_parms,
}

if $rsyslog::manage_confdir {
Expand Down
6 changes: 3 additions & 3 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
context 'with feature packages' do
let(:params) { { 'feature_packages' => %w[rsyslog-relp rsyslog-mmnormalize rsyslog-gnutls] } }

it { is_expected.to contain_package('rsyslog-relp').with_ensure('installed') }
it { is_expected.to contain_package('rsyslog-mmnormalize').with_ensure('installed') }
it { is_expected.to contain_package('rsyslog-gnutls').with_ensure('installed') }
it { is_expected.to contain_package('rsyslog-relp').with_ensure('installed').that_notifies('Service[rsyslog]') }
it { is_expected.to contain_package('rsyslog-mmnormalize').with_ensure('installed').that_notifies('Service[rsyslog]') }
it { is_expected.to contain_package('rsyslog-gnutls').with_ensure('installed').that_notifies('Service[rsyslog]') }
end

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

0 comments on commit df14a58

Please sign in to comment.