summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/service/redhat.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/provider/service/redhat.rb')
-rwxr-xr-xlib/puppet/provider/service/redhat.rb116
1 files changed, 58 insertions, 58 deletions
diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb
index 3a25db3ac..3ca67d66f 100755
--- a/lib/puppet/provider/service/redhat.rb
+++ b/lib/puppet/provider/service/redhat.rb
@@ -1,76 +1,76 @@
# Manage Red Hat services. Start/stop uses /sbin/service and enable/disable uses chkconfig
Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init do
- desc "Red Hat's (and probably many others) form of ``init``-style service management:
+ desc "Red Hat's (and probably many others) form of ``init``-style service management:
- Uses ``chkconfig`` for service enabling and disabling.
+ Uses ``chkconfig`` for service enabling and disabling.
- "
+ "
- commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service"
+ commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service"
- defaultfor :operatingsystem => [:redhat, :fedora, :suse, :centos, :sles, :oel, :ovm]
+ defaultfor :operatingsystem => [:redhat, :fedora, :suse, :centos, :sles, :oel, :ovm]
- def self.instances
- # this exclude list is all from /sbin/service (5.x), but I did not exclude kudzu
- self.get_services(['/etc/init.d'], ['functions', 'halt', 'killall', 'single', 'linuxconf'])
- end
-
- def self.defpath
- superclass.defpath
- end
-
- # Remove the symlinks
- def disable
- output = chkconfig(@resource[:name], :off)
- rescue Puppet::ExecutionFailure
- raise Puppet::Error, "Could not disable #{self.name}: #{output}"
- end
-
- def enabled?
- begin
- output = chkconfig(@resource[:name])
- 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
+ def self.instances
+ # this exclude list is all from /sbin/service (5.x), but I did not exclude kudzu
+ self.get_services(['/etc/init.d'], ['functions', 'halt', 'killall', 'single', 'linuxconf'])
+ end
- :true
- end
-
- # Don't support them specifying runlevels; always use the runlevels
- # in the init scripts.
- def enable
- output = chkconfig(@resource[:name], :on)
- rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not enable #{self.name}: #{detail}"
- end
-
- def initscript
- raise Puppet::Error, "Do not directly call the init script for '#{@resource[:name]}'; use 'service' instead"
- end
+ def self.defpath
+ superclass.defpath
+ end
- # use hasstatus=>true when its set for the provider.
- def statuscmd
- ((@resource.provider.get(:hasstatus) == true) || (@resource[:hasstatus] == :true)) && [command(:service), @resource[:name], "status"]
- end
+ # Remove the symlinks
+ def disable
+ output = chkconfig(@resource[:name], :off)
+ rescue Puppet::ExecutionFailure
+ raise Puppet::Error, "Could not disable #{self.name}: #{output}"
+ end
- def restartcmd
- (@resource[:hasrestart] == :true) && [command(:service), @resource[:name], "restart"]
+ def enabled?
+ begin
+ output = chkconfig(@resource[:name])
+ rescue Puppet::ExecutionFailure
+ return :false
end
- def startcmd
- [command(:service), @resource[:name], "start"]
+ # If it's disabled on SuSE, then it will print output showing "off"
+ # at the end
+ if output =~ /.* off$/
+ return :false
end
- def stopcmd
- [command(:service), @resource[:name], "stop"]
- end
+ :true
+ end
+
+ # Don't support them specifying runlevels; always use the runlevels
+ # in the init scripts.
+ def enable
+ output = chkconfig(@resource[:name], :on)
+ rescue Puppet::ExecutionFailure => detail
+ raise Puppet::Error, "Could not enable #{self.name}: #{detail}"
+ end
+
+ def initscript
+ raise Puppet::Error, "Do not directly call the init script for '#{@resource[:name]}'; use 'service' instead"
+ end
+
+ # use hasstatus=>true when its set for the provider.
+ def statuscmd
+ ((@resource.provider.get(:hasstatus) == true) || (@resource[:hasstatus] == :true)) && [command(:service), @resource[:name], "status"]
+ end
+
+ def restartcmd
+ (@resource[:hasrestart] == :true) && [command(:service), @resource[:name], "restart"]
+ end
+
+ def startcmd
+ [command(:service), @resource[:name], "start"]
+ end
+
+ def stopcmd
+ [command(:service), @resource[:name], "stop"]
+ end
end