summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/service/redhat.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2009-09-03 17:43:24 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-09-05 09:24:28 +1000
commitaba2f6600062c6935b65ebc2eeae0802e1f89a89 (patch)
tree252ed15abd6fddf7b6ec0e8d50d9b782c827b9f1 /lib/puppet/provider/service/redhat.rb
parentfb236a00459c375e4f2a94bdd924ed4e7fbd25eb (diff)
downloadpuppet-aba2f6600062c6935b65ebc2eeae0802e1f89a89.tar.gz
puppet-aba2f6600062c6935b65ebc2eeae0802e1f89a89.tar.xz
puppet-aba2f6600062c6935b65ebc2eeae0802e1f89a89.zip
This further normalizes the handling of init-style services (including
the redhat "service" wrapper script). Removes special case handling of non-zero exit code in redhat (base already did this) and centralizes scattered @resource[:has_____] checks. Tests that proper versions of each are called and one level of fallbacks. Signed-off-by: Markus Roberts <Markus@reality.com>
Diffstat (limited to 'lib/puppet/provider/service/redhat.rb')
-rwxr-xr-xlib/puppet/provider/service/redhat.rb27
1 files changed, 4 insertions, 23 deletions
diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb
index 8c12782d5..211b66956 100755
--- a/lib/puppet/provider/service/redhat.rb
+++ b/lib/puppet/provider/service/redhat.rb
@@ -52,35 +52,16 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init do
end
end
- def restart
- if @resource[:hasrestart] == :true
- service(@resource[:name], "restart")
- else
- super
- end
- end
-
- def status
- if @resource[:status]
- super
- elsif @resource[:hasstatus] == :true
- begin
- service(@resource[:name], "status")
- return :running
- rescue
- return :stopped
- end
- else
- super
- end
+ def initscript
+ raise Puppet::Error, "Do not directly call the init script for '%s'; use 'service' instead" % @resource[:name]
end
def statuscmd
- [command(:service), @resource[:name], "status"]
+ (@resource[:hasstatus] == :true) && [command(:service), @resource[:name], "status"]
end
def restartcmd
- [command(:service), @resource[:name], "restart"]
+ (@resource[:hasrestart] == :true) && [command(:service), @resource[:name], "restart"]
end
def startcmd