David L Ballenger
2012-Jul-10 22:09 UTC
[Puppet Users] Refresh not working with launchd service provider?
Hi, 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. Does anyone see anything wrong with the above files, or should I submit a bug report. Thanks - David -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Clay Caviness
2012-Aug-28 23:29 UTC
Re: [Puppet Users] Refresh not working with launchd service provider?
I''m seeing the same thing. 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: [...] 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 On Tue, Jul 10, 2012 at 6:09 PM, David L Ballenger <dlb@davidlballenger.com>wrote:> Hi, > > 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. > > Does anyone see anything wrong with the above files, or should I submit a > bug report. > > Thanks - David > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Clay Caviness
2012-Sep-06 17:46 UTC
Re: [Puppet Users] Refresh not working with launchd service provider?
I filed http://projects.puppetlabs.com/issues/16271 On Tue, Aug 28, 2012 at 7:29 PM, Clay Caviness <ccaviness@gmail.com> wrote:> I''m seeing the same thing. 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: > [...] > 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 > > On Tue, Jul 10, 2012 at 6:09 PM, David L Ballenger < > dlb@davidlballenger.com> wrote: > >> Hi, >> >> 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. >> >> Does anyone see anything wrong with the above files, or should I submit a >> bug report. >> >> Thanks - David >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.