puppet-systemd icon indicating copy to clipboard operation
puppet-systemd copied to clipboard

Unit_file: Add notify_service

Open fe80 opened this issue 2 years ago • 2 comments

Pull Request (PR) description

Hello,

I had add new parameters for Unit_file define, notify_service. This params I can use for disable the service notify. Very useful for not restart an in memory service for space or a new comment.

I've try to add spec but that not work. I've try something like that:

context 'notify_service => false' do
  let(:params) { { enable: true, notify_service: false } }
  
  it do
    expect(subject).to contain_service(title).
      without_subscribes_to("File[/etc/systemd/system/#{title}]")
  end
end

or

context 'notify_service => false' do
  let(:params) { { enable: true, notify_service: false } }
  
  it do
    expect(subject).to contain_file("/etc/systemd/system/#{title}").
      without_notifies("Service[#{title}]")
  end
end

Can you help me for this part ?

This Pull Request (PR) fixes the following issues

Regards,

fe80 avatar Sep 21 '22 08:09 fe80

I think there's no such thing as without_notifies or without_subscribes_to. The closest I can think of is

it { is_expected.not_to contain_service(title).with_subscribes_to("File[/etc/systemd/system/#{title}]")

Slight nuance is that it's also true if the service is not contained in the catalog. Perhaps a possible enhancement for https://github.com/puppetlabs/rspec-puppet?

ekohl avatar Sep 21 '22 11:09 ekohl

Hello @ekohl

Thank it's look good !

I've also create an issue here https://github.com/puppetlabs/rspec-puppet/issues/28

Regards,

fe80 avatar Sep 23 '22 07:09 fe80

implemented in https://github.com/voxpupuli/puppet-systemd/pull/433

TheMeier avatar Mar 13 '24 06:03 TheMeier