diff --git a/manifests/dropin_file.pp b/manifests/dropin_file.pp index 6229444e..6b685f22 100644 --- a/manifests/dropin_file.pp +++ b/manifests/dropin_file.pp @@ -81,7 +81,7 @@ File[$full_filename] ~> Service <| title == $unit or name == $unit |> if $daemon_reload { - Systemd::Daemon_reload[$unit] ~> Service <| title == $unit or name == $unit |> + Systemd::Daemon_reload[$unit] -> Service <| title == $unit or name == $unit |> } if $unit =~ /\.service$/ { @@ -89,7 +89,7 @@ File[$full_filename] ~> Service <| title == $short_service_name or name == $short_service_name |> if $daemon_reload { - Systemd::Daemon_reload[$unit] ~> Service <| title == $short_service_name or name == $short_service_name |> + Systemd::Daemon_reload[$unit] -> Service <| title == $short_service_name or name == $short_service_name |> } } } diff --git a/spec/defines/dropin_file_spec.rb b/spec/defines/dropin_file_spec.rb index 28df2e07..544e4102 100644 --- a/spec/defines/dropin_file_spec.rb +++ b/spec/defines/dropin_file_spec.rb @@ -69,10 +69,32 @@ it { is_expected.to compile.with_all_deps } it { is_expected.to contain_service('myservice').that_subscribes_to("File[#{filename}]") } - it { is_expected.to contain_systemd__daemon_reload(params[:unit]).that_notifies('Service[myservice]') } + it { is_expected.not_to contain_systemd__daemon_reload(params[:unit]).that_notifies('Service[myservice]') } + it { is_expected.to contain_systemd__daemon_reload(params[:unit]).that_comes_before('Service[myservice]') } end end + context 'doesn\'t notify services' do + let(:params) do + super().merge(notify_service: false) + end + let(:filename) { "/etc/systemd/system/#{params[:unit]}.d/#{title}" } + let(:pre_condition) do + <<-PUPPET + service { ['test', 'test.service']: + } + PUPPET + end + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_service('test') } + it { is_expected.not_to contain_service('test').that_subscribes_to("File[#{filename}]") } + it { is_expected.not_to contain_service('test').that_subscribes_to("Systemd::Daemon_reload[#{params[:unit]}]") } + it { is_expected.to contain_service('test.service') } + it { is_expected.not_to contain_service('test.service').that_subscribes_to("File[#{filename}]") } + it { is_expected.not_to contain_service('test.service').that_subscribes_to("Systemd::Daemon_reload[#{params[:unit]}]") } + end + context 'with selinux_ignore_defaults set to true' do let(:params) do super().merge(selinux_ignore_defaults: true)