diff options
author | James Turnbull <james@lovedthanlost.net> | 2008-04-24 23:23:22 +1000 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-04-24 23:23:22 +1000 |
commit | b2a3db94c7226c7660277c746254f47ab40cde7b (patch) | |
tree | edb42b68ac7ec3944f7198eea6b87a26289afe24 /lib | |
parent | 62ca72608c8fcded624c46c6951b9381a7284a80 (diff) | |
download | puppet-b2a3db94c7226c7660277c746254f47ab40cde7b.tar.gz puppet-b2a3db94c7226c7660277c746254f47ab40cde7b.tar.xz puppet-b2a3db94c7226c7660277c746254f47ab40cde7b.zip |
Fixed #1196 - added /sbin/service support for the redhat service provider + some doco fixes
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/puppet/provider/service/base.rb | 8 | ||||
-rwxr-xr-x | lib/puppet/provider/service/init.rb | 6 | ||||
-rwxr-xr-x | lib/puppet/provider/service/redhat.rb | 25 |
3 files changed, 28 insertions, 11 deletions
diff --git a/lib/puppet/provider/service/base.rb b/lib/puppet/provider/service/base.rb index 254b4fe4c..8964322b6 100755 --- a/lib/puppet/provider/service/base.rb +++ b/lib/puppet/provider/service/base.rb @@ -1,10 +1,10 @@ Puppet::Type.type(:service).provide :base do desc "The simplest form of service support. You have to specify enough about your service for this to work; the minimum you can specify - is a binary for starting the process, and this same binary will be searched - for in the process table to stop the service. It is preferable to - specify start, stop, and status commands, akin to how you would do - so using ``init``." + is a binary for starting the process, and this same binary will be + searched for in the process table to stop the service. It is + preferable to specify start, stop, and status commands, akin to how you + would do so using ``init``." commands :kill => "kill" diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb index 274c334a3..3081d0eb8 100755 --- a/lib/puppet/provider/service/init.rb +++ b/lib/puppet/provider/service/init.rb @@ -2,9 +2,9 @@ # customizations of this module. Puppet::Type.type(:service).provide :init, :parent => :base do desc "Standard init service management. This provider assumes that the - init script has not ``status`` command, because so few scripts do, - so you need to either provide a status command or specify via ``hasstatus`` - that one already exists in the init script." + init script has no ``status`` command, because so few scripts do, + so you need to either provide a status command or specify via + ``hasstatus`` that one already exists in the init script." class << self attr_accessor :defpath diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb index b013c34dc..356f6ffbe 100755 --- a/lib/puppet/provider/service/redhat.rb +++ b/lib/puppet/provider/service/redhat.rb @@ -1,11 +1,11 @@ -# Manage debian services. Start/stop is the same as InitSvc, but enable/disable -# is special. +# Manage Red Hat services. Start/stop uses /sbin/service and enable/disable uses chkconfig + 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." - commands :chkconfig => "/sbin/chkconfig" - + commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service" + defaultfor :operatingsystem => [:redhat, :fedora, :suse, :centos] def self.defpath @@ -50,5 +50,22 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init do [self.name, detail] end end + + def restart + if @resource[:hasrestart] == true + service(@resource[:name], "restart") + else + return false + end + end + + def start + service(@resource[:name], "start") + end + + def stop + service(@resource[:name], "stop") + end + end |