30: def self.instances
31: self.defpath = [self.defpath] unless self.defpath.is_a? Array
32:
33: instances = []
34:
35: self.defpath.each do |path|
36: unless FileTest.directory?(path)
37: Puppet.debug "Service path %s does not exist" % path
38: next
39: end
40:
41: check = [:ensure]
42:
43: if public_method_defined? :enabled?
44: check << :enable
45: end
46:
47: Dir.entries(path).each do |name|
48: fullpath = File.join(path, name)
49: next if name =~ /^\./
50: next if not FileTest.executable?(fullpath)
51: instances << new(:name => name, :path => path)
52: end
53: end
54: instances
55: end