Issue #2773 has been updated by Nigel Kersten.

To clarify, I feel like there might be a cluster of issues around replacing an 
existing plist, where the original job is loaded and has completely different 
characteristics to the new plist, but I haven't had the time to go through all 
the possible permutations. 

We may be able to do some fiddling around with getting launchctl info for a 
particular job (for 10.5 and higher) before we decide how to apply desired 
state, but it's going to be rather complicated, so I'd like to find the common 
cases first.
----------------------------------------
Bug #2773: buglet in provider/service/launchd.rb
http://projects.reductivelabs.com/issues/2773

Author: eric sorenson
Status: Accepted
Priority: Normal
Assigned to: Nigel Kersten
Category: service
Target version: unplanned
Affected version: 0.25.1
Keywords: osx launchd
Branch: 


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://reductivelabs.com/redmine/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