[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:21:41 UTC 2009


The following commit has been merged in the master branch:
commit 43967408a166ca4155b1febae987300b2b327f97
Author: Nigel Kersten <nigelk at google.com>
Date:   Tue Nov 18 14:40:00 2008 -0800

    Fix the init service type to cope with an array for defpath and if defpath does not exist

diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb
index e95fbd0..3dc12ca 100755
--- a/lib/puppet/provider/service/init.rb
+++ b/lib/puppet/provider/service/init.rb
@@ -24,24 +24,30 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
 
     # List all services of this type.
     def self.instances
-        path = self.defpath
-        unless FileTest.directory?(path)
-            Puppet.notice "Service path %s does not exist" % path
-            next
-        end
-
-        check = [:ensure]
-
-        if public_method_defined? :enabled?
-            check << :enable
-        end
-
-        Dir.entries(path).reject { |e|
-            fullpath = File.join(path, e)
-            e =~ /^\./ or ! FileTest.executable?(fullpath)
-        }.collect do |name|
-            new(:name => name, :path => path)
+        self.defpath = [self.defpath] unless self.defpath.is_a? Array
+        
+        instances = []
+        
+        self.defpath.each do |path|
+            unless FileTest.directory?(path)
+                Puppet.notice "Service path %s does not exist" % path
+                next
+            end
+        
+            check = [:ensure]
+        
+            if public_method_defined? :enabled?
+                check << :enable
+            end
+            
+            Dir.entries(path).each do |name|
+                fullpath = File.join(path, name)
+                next if name =~ /^\./
+                next if not FileTest.executable?(fullpath)
+                instances << new(:name => name, :path => path)
+            end
         end
+        instances
     end
 
     # Mark that our init script supports 'status' commands.

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list