[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Markus Roberts Markus at reality.com
Wed Jul 14 10:36:43 UTC 2010


The following commit has been merged in the upstream branch:
commit 8d3ced5d63e06c4858f067d49f1e3dc7875630e9
Author: Dan Bode <dan at reductivelabs.com>
Date:   Sun Jul 4 19:06:04 2010 -0400

    created init provider method self.get_services which accepts an array of filenames to exclude when processing defpath.
    
    also updated redhat provider to pass in a list of services to ignore.
    
    didnt need to munch exclude to an array, include? is safe to call on strings

diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb
index c05a326..58b7f91 100755
--- a/lib/puppet/provider/service/init.rb
+++ b/lib/puppet/provider/service/init.rb
@@ -28,11 +28,13 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
 
     # List all services of this type.
     def self.instances
-        self.defpath = [self.defpath] unless self.defpath.is_a? Array
+        get_services(self.defpath)
+    end
 
+    def self.get_services(defpath, exclude=[])
+        defpath = [defpath] unless defpath.is_a? Array
         instances = []
-
-        self.defpath.each do |path|
+        defpath.each do |path|
             unless FileTest.directory?(path)
                 Puppet.debug "Service path %s does not exist" % path
                 next
@@ -47,6 +49,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
             Dir.entries(path).each do |name|
                 fullpath = File.join(path, name)
                 next if name =~ /^\./
+                next if exclude.include? name 
                 next if not FileTest.executable?(fullpath)
                 instances << new(:name => name, :path => path)
             end
diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb
index 45a9074..065efe6 100755
--- a/lib/puppet/provider/service/redhat.rb
+++ b/lib/puppet/provider/service/redhat.rb
@@ -11,6 +11,11 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
 
     defaultfor :operatingsystem => [:redhat, :fedora, :suse, :centos, :sles, :oel, :ovm]
 
+    def self.instances
+        # this exclude list is all from /sbin/service (5.x), but I did not exclude kudzu
+        self.get_services(['/etc/init.d/'], ['functions', 'halt', 'killall', 'single', 'linuxconf'])
+    end
+
     def self.defpath
         superclass.defpath
     end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list