Issue #16271 has been updated by Clay Caviness.

David Ballenger originally posted on puppet-users about this:

Refresh doesn't seem to be working with the launched service provider on OS X 
Lion (10.7.4).

I've come up with a simple "service" script, plist file and puppet script to 
apply to demonstrate.  The problem.

Here's the shell script which logs an initial starting message and then just 
loops logging a "Still running…" message.

/usr/local/bin/example.sh:

        #!/bin/sh

        # We need to trap on TERM signals, according to Apple's launchd docs:
        #
        trap 'exit 1' 15

        syslog -s -l 1 example.sh: Starting...

        while true; do
            sleep 15
            syslog -s -l 1 example.sh: Still running...
        done

Here's the launchd plist.

/Library/LaunchDaemons/net.davidlballenger.example.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>KeepAlive</key>
          <true/>
          <key>Label</key>
          <string>net.davidlballenger.example</string>
          <key>ProgramArguments</key>
          <array>
            <string>/usr/local/bin/example.sh</string>
          </array>
        </dict>
        </plist>

Here's the example.pp file:

        $service_name = 'net.davidlballenger.example'
        $file_path = "/var/tmp/${service_name}"

        file { $file_path :
          content => $uptime_seconds ,
        }

        service { $service_name :
          ensure    => running,
          enable    => true,
          subscribe => File[ $file_path ],
        }

The File resource is updated with the facter variable $uptime_seconds each time 
it runs.  And the Service subscribes to the that File resource.

Assuming the script and plist file are in the appropriate places, then applying 
example.pp will start the service if it is not already running.  But subsequent 
runs will not restart it, even though the log messages say that the file's 
content changed and that it triggered a refresh of the service.

If I run the apply with --debug, the only launchctl command that I see in the 
output is a launchctl list command.

----------------------------------------
Bug #16271: launchd resources don't refresh/restart
https://projects.puppetlabs.com/issues/16271#change-70617

Author: Clay Caviness
Status: Unreviewed
Priority: Normal
Assignee: 
Category: OSX
Target version: 
Affected Puppet version: 2.7.18
Keywords: 
Branch: 


I can't actually recall the last time I verified it was working, but it *was* 
at some point in the past.

Currently it's not, though, at least with puppet 2.7.18 on OS X 10.8.1.

Debug output shows a trigger of a refresh, but no execs are ever run:
<pre>
[...]
notice: /Stage[main]//Service[com.apple.mDNSResponder]: Triggered 'refresh' 
from 1 events
debug: /Stage[main]//Service[com.apple.mDNSResponder]: The container 
Class[Main] will propagate my refresh event
debug: /Schedule[weekly]: Skipping device resources because running on a host
debug: /Schedule[puppet]: Skipping device resources because running on a host
debug: Class[Main]: The container Stage[main] will propagate my refresh event
debug: Finishing transaction 2223267580
debug: Storing state
debug: Stored state in 0.29 seconds
notice: Finished catalog run in 15.52 seconds
</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