Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Puppet IRC channel answered my question.

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

share|improve this answer
1  
Also see projects.puppetlabs.com/issues/7165 which may be more relevant. –  Jon Topper Nov 4 '11 at 14:22
    
Yep, the ticket I've posted the link to is the dupe of your one. –  Erthad Nov 19 '11 at 21:24
add comment

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.
share|improve this answer
    
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. –  Erthad Oct 12 '11 at 6:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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