diff options
author | Luke Kanies <luke@madstop.com> | 2009-06-16 13:11:26 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-06-26 11:38:02 +1000 |
commit | 5680cd5029c8b3a2cf5a2a3b10df6acf7a9fc870 (patch) | |
tree | 4b760295be6d48cdc4f5febfcbfe99454e761f72 /lib | |
parent | 603b9cf1a435f6662db39be66f91527a8e20c112 (diff) | |
download | puppet-5680cd5029c8b3a2cf5a2a3b10df6acf7a9fc870.tar.gz puppet-5680cd5029c8b3a2cf5a2a3b10df6acf7a9fc870.tar.xz puppet-5680cd5029c8b3a2cf5a2a3b10df6acf7a9fc870.zip |
Fixing #2197 - daemontools tests now pass
This actually involved a bit of rewriting
of the code, but the code's simpler now, too.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/service/daemontools.rb | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/lib/puppet/provider/service/daemontools.rb b/lib/puppet/provider/service/daemontools.rb index 63666e149..f6eb5099f 100644 --- a/lib/puppet/provider/service/daemontools.rb +++ b/lib/puppet/provider/service/daemontools.rb @@ -129,14 +129,6 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do [command(:svc), "-u", self.service ] end - def stopcmd - [command(:svc), "-d", self.service ] - end - - def restartcmd - [ command(:svc), "-t", self.service] - end - def setupservice begin if resource[:manifest] @@ -161,23 +153,49 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do def enable begin - if ! FileTest.directory?(self.daemon) - Puppet.notice "No daemon dir, calling setupservice for %s" % resource[:name] - self.setupservice - end - if self.daemon - if ! FileTest.symlink?(self.service) - Puppet.notice "Enabling %s: linking %s -> %s" % [ self.service, self.daemon, self.service ] - File.symlink(self.daemon, self.service) + if ! FileTest.directory?(self.daemon) + Puppet.notice "No daemon dir, calling setupservice for %s" % resource[:name] + self.setupservice + end + if self.daemon + if ! FileTest.symlink?(self.service) + Puppet.notice "Enabling %s: linking %s -> %s" % [ self.service, self.daemon, self.service ] + File.symlink(self.daemon, self.service) + end end - end rescue Puppet::ExecutionFailure => detail raise Puppet::Error.new( "No daemon directory found for %s" % self.service ) end end def disable + begin + if ! FileTest.directory?(self.daemon) + Puppet.notice "No daemon dir, calling setupservice for %s" % resource[:name] + self.setupservice + end + if self.daemon + if FileTest.symlink?(self.service) + Puppet.notice "Disabling %s: removing link %s -> %s" % [ self.service, self.daemon, self.service ] + File.unlink(self.service) + end + end + rescue Puppet::ExecutionFailure => detail + raise Puppet::Error.new( "No daemon directory found for %s" % self.service ) + end self.stop end -end + def restart + svc "-t", self.service + end + + def start + enable unless enabled? + svc "-u", self.service + end + + def stop + svc "-d", self.service + end +end |