2

When service is described with both ensure => running and subscribed to config file changes if both conditions fulfil (i.e. it is not running and config file changed) it gets (re)started twice. Is there a way to make it start only once?

To clarify, I have the following type:

    service { "puppet":
      ensure     => running,
      enable     => true,
      hasrestart => true,
      subscribe  => File["/etc/puppet/puppet.conf"],
    } # service

When both /etc/puppet/puppet.conf is changed and service puppet is not running I see the following in puppet output (with --debug specified):

....
debug: /Stage[main]/Puppet/Service[puppet]/subscribe: subscribes to File[/etc/puppet/puppet.conf]
notice: /Stage[main]/Puppet/File[/etc/puppet/puppet.conf]/content: content changed '{md5}c39350dd1e135cf9fffd14ff167d6655' to '{md5}845a4aac5e83ab3f8cd9efd80ce17772'
....
info: /etc/puppet/puppet.conf: Scheduling refresh of Service[puppet]
debug: /etc/puppet/puppet.conf: The container Class[Puppet] will propagate my refresh event
info: /etc/puppet/puppet.conf: Scheduling refresh of Service[puppet]
debug: Service[puppet](provider=debian): Executing '/etc/init.d/puppet status'
debug: Service[puppet](provider=debian): Executing '/etc/init.d/puppet start'
notice: /Stage[main]/Puppet/Service[puppet]/ensure: ensure changed 'stopped' to 'running'
debug: /Stage[main]/Puppet/Service[puppet]: The container Class[Puppet] will propagate my refresh event
debug: Service[puppet](provider=debian): Executing '/etc/init.d/puppet status'
debug: Service[puppet](provider=debian): Executing '/etc/init.d/puppet restart'
err: /Stage[main]/Puppet/Service[puppet]: Failed to call refresh: Could not restart Service[puppet]: Execution of '/etc/init.d/puppet restart' returned 1:  at /etc/puppet/modules/puppet/manifests/init.pp:32

This obviously fails because of the following:

root:~# /etc/init.d/puppet restart ; /etc/init.d/puppet restart
 * Restarting puppet agent                                         [ OK ] 
 * Restarting puppet agent                                         [fail] 

Is there a way to cope with that?

3

Puppet IRC channel answered my question.

It is a bug of Puppet and it is described here: http://projects.puppetlabs.com/issues/show/9656

0

I'm away from my puppet install at the moment, but a couple of things:

  1. What version of puppet are you running?
  2. Funny things always happen to me when I forget to add 'hasstatus => true' to my services. It may not fix your problem, but it shouldn't hurt anything.
  • I'm using 2.7.3 deb package from puppetlabs apt repository. Thank you for advice about hasstatus => true, I'll keep that in mind. – timurb Oct 12 '11 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.