diff options
| author | Luke Kanies <luke@madstop.com> | 2005-07-16 01:57:18 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-07-16 01:57:18 +0000 |
| commit | f38bdef90367a0beb9074bbaa4d5fa384660f7a8 (patch) | |
| tree | 006559fd656a0d83ed5bf587aef41f5d7b46a370 /lib/puppet | |
| parent | 84f721d93e8914b32daa6290004547352f0c9044 (diff) | |
| download | puppet-f38bdef90367a0beb9074bbaa4d5fa384660f7a8.tar.gz puppet-f38bdef90367a0beb9074bbaa4d5fa384660f7a8.tar.xz puppet-f38bdef90367a0beb9074bbaa4d5fa384660f7a8.zip | |
changing path stuff to be service-specific
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@408 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/type/service.rb | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/puppet/type/service.rb b/lib/puppet/type/service.rb index bbfef6716..ce7a07cbb 100644 --- a/lib/puppet/type/service.rb +++ b/lib/puppet/type/service.rb @@ -101,7 +101,8 @@ module Puppet ] @parameters = [ :name, - :pattern + :pattern, + :path ] @functions = [ @@ -114,12 +115,21 @@ module Puppet @searchpaths = Array.new @allowedmethods = [:setpath] - def Service.search(name) + def initialize(hash) + super + + if hash[:path] + self.setpath(hash[:path]) + else + raise "You must specify a search path for service %s" % self.name + end + end + + def search(name) @searchpaths.each { |path| - # must specify that we want the top-level File, not Puppet::...::File - fqname = ::File.join(path,name) + fqname = File.join(path,name) begin - stat = ::File.stat(fqname) + stat = File.stat(fqname) rescue # should probably rescue specific errors... debug("Could not find %s in %s" % [name,path]) @@ -132,17 +142,13 @@ module Puppet raise "Could not find init script for '%s'" % name end - def Service.searchpath - return @searchpaths - end - - def Service.setpath(ary) + def setpath(ary) # verify each of the paths exists #ary.flatten! @searchpaths = ary.find_all { |dir| retvalue = false begin - retvalue = ::File.stat(dir).directory? + retvalue = File.stat(dir).directory? rescue => detail debug("Directory %s does not exist: %s" % [dir,detail]) # just ignore it @@ -178,7 +184,7 @@ module Puppet if defined? @initscript return @initscript else - @initscript = Service.search(self.name) + @initscript = self.search(self.name) end end |
