[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5

James Turnbull james at lovedthanlost.net
Wed Apr 8 21:48:13 UTC 2009


The following commit has been merged in the master branch:
commit 0bc3c0785cd11c79f8cd5e9c8804f6694dbc7da4
Author: Nigel Kersten <nigelk at google.com>
Date:   Mon Feb 9 16:27:15 2009 -0800

    Fix launchd service provider so it is backwards compatible with OS X 10.4 as well
    
    Clean up fix to launchd service provider to be more concise

diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb
index 891c96b..64b61ff 100644
--- a/lib/puppet/provider/service/launchd.rb
+++ b/lib/puppet/provider/service/launchd.rb
@@ -103,12 +103,21 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
 
     def status
         # launchctl list <jobname> exits zero if the job is loaded
-        # and non-zero if it isn't. Simple way to check...
+        # and non-zero if it isn't. Simple way to check... but is only
+        # available on OS X 10.5 unfortunately, so we grab the whole list
+        # and check if our resource is included. The output formats differ
+        # between 10.4 and 10.5, thus the necessity for splitting
         begin
-            launchctl :list, resource[:name]           
-            return :running
-        rescue Puppet::ExecutionFailure
+            output = launchctl :list
+            if output.nil?
+                raise Puppet::Error.new("launchctl list failed to return any data.")
+            end
+            output.split("\n").each do |j|
+                return :running if j.split(/\s/).last == resource[:name]
+            end
             return :stopped
+        rescue Puppet::ExecutionFailure
+            raise Puppet::Error.new("Unable to determine status of #{resource[:name]}")
         end
     end
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list