Puppet restarts services twice — can it be fixed

puppet

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?

Best Answer

Puppet IRC channel answered my question.

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

Related Topic