summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/service/redhat.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-03 01:56:45 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-03 01:56:45 +0000
commit2cb2e03071f3411d1418ec19b14b0d13035e691a (patch)
tree03b2bc208ca3ec12248c4184fd9ae19785dbb32e /lib/puppet/provider/service/redhat.rb
parent712e157c826f23085820b0e64fd6832382a89f2f (diff)
downloadpuppet-2cb2e03071f3411d1418ec19b14b0d13035e691a.tar.gz
puppet-2cb2e03071f3411d1418ec19b14b0d13035e691a.tar.xz
puppet-2cb2e03071f3411d1418ec19b14b0d13035e691a.zip
Applying patch from #251, and switching "confine" to "commands", so we can document the command requirements.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1535 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider/service/redhat.rb')
-rwxr-xr-xlib/puppet/provider/service/redhat.rb20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb
index e599e63f1..45db9f193 100755
--- a/lib/puppet/provider/service/redhat.rb
+++ b/lib/puppet/provider/service/redhat.rb
@@ -4,15 +4,15 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init do
desc "Red Hat's (and probably many others) form of ``init``-style service
management; uses ``chkconfig`` for service enabling and disabling."
- confine :exists => "/sbin/chkconfig"
+ commands :chkconfig => "/sbin/chkconfig"
- defaultfor :operatingsystem => [:redhat, :fedora]
+ defaultfor :operatingsystem => [:redhat, :fedora, :suse]
# Remove the symlinks
def disable
begin
- output = util_execute("/sbin/chkconfig #{@model[:name]} off 2>&1")
- output += util_execute("/sbin/chkconfig --del #{@model[:name]} 2>&1")
+ output = util_execute("#{command(:chkconfig)} #{@model[:name]} off 2>&1")
+ output += util_execute("#{command(:chkconfig)} --del #{@model[:name]} 2>&1")
rescue Puppet::ExecutionFailure
raise Puppet::Error, "Could not disable %s: %s" %
[self.name, output]
@@ -21,11 +21,17 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init do
def enabled?
begin
- output = util_execute("/sbin/chkconfig #{@model[:name]} 2>&1").chomp
+ output = util_execute("#{command(:chkconfig)} #{@model[:name]} 2>&1").chomp
rescue Puppet::ExecutionFailure
return :false
end
+ # If it's disabled on SuSE, then it will print output showing "off"
+ # at the end
+ if output =~ /.* off$/
+ return :false
+ end
+
return :true
end
@@ -33,8 +39,8 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init do
# in the init scripts.
def enable
begin
- output = util_execute("/sbin/chkconfig --add #{@model[:name]} 2>&1")
- output += util_execute("/sbin/chkconfig #{@model[:name]} on 2>&1")
+ output = util_execute("#{command(:chkconfig)} --add #{@model[:name]} 2>&1")
+ output += util_execute("#{command(:chkconfig)} #{@model[:name]} on 2>&1")
rescue Puppet::ExecutionFailure
raise Puppet::Error, "Could not enable %s: %s" %
[self.name, output]