Issue #15929 has been updated by Clay Caviness.

<pre>$ $ diff -u 
/tmp/puppet-2.7.19-src/puppet-2.7.19/lib/puppet/provider/service/launchd.rb 
launchd.rb 
--- /tmp/puppet-2.7.19-src/puppet-2.7.19/lib/puppet/provider/service/launchd.rb 
2012-08-21 17:41:17.000000000 -0400
+++ launchd.rb  2012-10-02 12:40:19.000000000 -0400
@@ -141,7 +143,12 @@
   # Read a plist, whether its format is XML or in Apple's "binary1"
   # format.
   def self.read_plist(path)
-    Plist::parse_xml(plutil('-convert', 'xml1', '-o', '/dev/stdout', path))
+    begin
+      Plist::parse_xml(plutil('-convert', 'xml1', '-o', '/dev/stdout', path))
+    rescue Puppet::ExecutionFailure => detail
+      Puppet.warning("Could not read #{path}: #{detail}")
+      return nil
+    end
   end
</pre>
----------------------------------------
Bug #15929: launchd service provider can't handle malformed plists
https://projects.puppetlabs.com/issues/15929#change-72175

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


If there's a zero-length or other un-parseable plist in the 
{/System}/Library/Launch{Daemons,Agents}/ directories, the launcd service 
provider gives up.

<pre>
$ sudo touch /Library/LaunchDaemons/foo
$ sudo puppet resource service
Could not run: Execution of '/usr/bin/plutil -convert xml1 -o /dev/stdout 
/Library/LaunchDaemons/foo' returned 1: /Library/LaunchDaemons/foo: Property 
List error: Cannot parse a NULL or zero-length data / JSON error: No value.
</pre>

There is a non-zero chance a zero-length file can show up if a puppet run is 
interrupted, leaving a file named something like 
`/Library/LaunchDaemons/com.company.foo.plist.puppettmp_2620`; after this tmp 
file is left, all further puppet runs will fail.

I think the provider should warn on parse/convert errors, but still continue on 
with those services it's able to read.


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