summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorNigel Kersten <nigelk@google.com>2008-11-18 14:40:00 -0800
committerJames Turnbull <james@lovedthanlost.net>2008-11-19 14:00:34 +1100
commit43967408a166ca4155b1febae987300b2b327f97 (patch)
tree4a1b44987cd7fe4bbfa1ae0f3b85169e41102faf /lib/puppet
parent3c870d8f33eb757ddc16c33e89618a58685606fd (diff)
downloadpuppet-43967408a166ca4155b1febae987300b2b327f97.tar.gz
puppet-43967408a166ca4155b1febae987300b2b327f97.tar.xz
puppet-43967408a166ca4155b1febae987300b2b327f97.zip
Fix the init service type to cope with an array for defpath and if defpath does not exist
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/provider/service/init.rb40
1 files changed, 23 insertions, 17 deletions
diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb
index e95fbd0f9..3dc12caa2 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.