Issue #2773 has been updated by Michael Stahnke.

Status changed from Merged - Pending Release to Closed

released in 2.7.10rc1
----------------------------------------
Bug #2773: buglet in provider/service/launchd.rb
https://projects.puppetlabs.com/issues/2773

Author: eric sorenson
Status: Closed
Priority: High
Assignee: Gary Larizza
Category: service
Target version: 2.7.10
Affected Puppet version: 0.25.1
Keywords: osx launchd
Branch: https://github.com/puppetlabs/puppet/pull/324


I added a persistent postfix plist to replace the run-on-demand one distributed 
with OSX. (Which causes our nagios mailqueue check to fail annoyingly because 
qmgr doesn't run all the time).  So upon copying the plist, process status 
should have been 'enabled' but 'stopped'. But it wouldn't start up by itself:

<pre>
debug: Service[postfix](provider=launchd): Executing 'launchctl load 
/System/Library/LaunchDaemons/org.postfix.master.plist'
err: //mail::nullclient/Service[postfix]/ensure: change from stopped to running 
failed: Unable to start service: 
   org.postfix.master at path: 
/System/Library/LaunchDaemons/org.postfix.master.plist
</pre>

I manually got it working with 'launchctl load -w' , but the conditional in the 
start() method was not being triggered. After resetting my system back to 
previous state and changing the check as below, I get the expected result:

<pre>
debug: //mail::nullclient/Service[postfix]: Changing ensure
debug: //mail::nullclient/Service[postfix]: 1 change(s)
debug: Service[postfix](provider=launchd): Executing 'launchctl load -w 
/System/Library/LaunchDaemons/org.postfix.master.plist'
notice: //mail::nullclient/Service[postfix]/ensure: ensure changed 'stopped' to 
'running'
</pre>

So it seems 'enabled' (in puppet's view of things) but 'stopped' may still need 
-w to overcome a 'disabled' key in launchd's little mind. What do you think?

<pre>
--- a/lib/puppet/provider/service/launchd.rb
+++ b/lib/puppet/provider/service/launchd.rb
@@ -163,7 +163,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => 
:base do
         did_enable_job = false
         cmds = []
         cmds << :launchctl << :load
-        if self.enabled? == :false  # launchctl won't load disabled jobs
+        if self.enabled? == :false || self.status == :stopped # launchctl 
won't load disabled jobs
             cmds << "-w"
             did_enable_job = true
         end
</pre>




-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to