Issue #2773 has been updated by eric sorenson.

eric sorenson wrote:
> I think Nigel's update in Comment 4 is right in that I am doing enough 
> questionable things to make this an edge-case.   

I've spent some more time with this (and just clobbered my own update to the 
ticket! argh) and now I do think we ought to be more aggressive about using 
'launchctl load -w' because, at least on snow leopard, my newly-added 
non-conflicting plists are not getting loaded otherwise. Using '-w' doesn't 
hurt anything if it's already enabled AFAIK.

<pre>
debug: Puppet::Type::Service::ProviderLaunchd: Executing '/bin/launchctl list'
debug: //puppet-client::service/Service[puppetd]: Changing ensure
debug: //puppet-client::service/Service[puppetd]: 1 change(s)
debug: Service[puppetd](provider=launchd): Executing 'launchctl load 
/Library/LaunchDaemons/com.reductivelabs.puppet.plist'
err: //puppet-client::service/Service[puppetd]/ensure: change from stopped to 
running failed: Unable to start service:
 com.reductivelabs.puppet at path: 
/Library/LaunchDaemons/com.reductivelabs.puppet.plist
</pre>

Here's the shell equivalents and the plist:
<pre>
[r...@leterel /usr/local/sbin]# launchctl load 
/Library/LaunchDaemons/com.reductivelabs.puppet.plist 
nothing found to load
[r...@leterel /usr/local/sbin]# echo $?
1
[r...@leterel /usr/local/sbin]# launchctl load -w 
/Library/LaunchDaemons/com.reductivelabs.puppet.plist
[r...@leterel /usr/local/sbin]# cat 
/Library/LaunchDaemons/com.reductivelabs.puppet.plist 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
        <key>EnvironmentVariables</key>
        <dict>
                <key>PATH</key>
                
<string>/usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin</string>
        </dict>
        <key>Label</key>
        <string>com.reductivelabs.puppet</string>
        <key>OnDemand</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
                <string>puppetd</string>
                <string>--verbose</string>
                <string>--logdest=/var/puppet/log/puppetd.log</string>
                <string>--no-daemonize</string>
                <string>--color=false</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/var/puppet/log/puppetd.err</string>
        <key>StandardOutPath</key>
        <string>/var/puppet/log/puppetd.out</string>
</dict>
</plist>

</pre>


----------------------------------------
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