Eric, you sent a patch to fix this didn't you?
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:
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
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:
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'
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?
--- 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
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
I've just been using the one-line patch inline at the problem description with no ill effects - I haven't pushed a real git commit.
Eric,
Have you seen any ill-effects out of the change in launchd.rb? I'm seeing this pop up and am wondering if you've had good luck with that fix.
It looks to me like we need some tests around this?
Gary – any chance you can look at the tests for this in your copious spare time? :)
Sure – thanks for the reminder on it :) I just submitted a bunch of tests to launchd, and I guess I should probably work on it while it’s fresh in my head :)
I updated the code and created spec tests to account for this. Eric, take a look and see if it meets the condition you’re encountering.
released in 2.7.10rc1