summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-05 23:46:32 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-05 23:46:32 +0000
commit2113eed0137630836b3de3e2a8bc17b6cb7198e8 (patch)
tree7c7af351497339aa4640fc6fe2debe5a7d8f5023 /lib/puppet
parentfcc5bae22cb2a0286975cfc0bcab52a2a7f7973d (diff)
downloadpuppet-2113eed0137630836b3de3e2a8bc17b6cb7198e8.tar.gz
puppet-2113eed0137630836b3de3e2a8bc17b6cb7198e8.tar.xz
puppet-2113eed0137630836b3de3e2a8bc17b6cb7198e8.zip
Adding hasrestart parameter to services
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1569 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/provider/service/init.rb28
-rw-r--r--lib/puppet/type/service.rb6
2 files changed, 15 insertions, 19 deletions
diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb
index 76cac2763..90f7c26a7 100755
--- a/lib/puppet/provider/service/init.rb
+++ b/lib/puppet/provider/service/init.rb
@@ -81,25 +81,6 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
end
end
- # it'd be nice if i didn't throw the output away...
- # this command returns true if the exit code is 0, and returns
- # false otherwise
- def initcmd(cmd)
- script = self.initscript
-
- self.debug "Executing '%s %s' as initcmd for '%s'" %
- [script,cmd,self]
-
- rvalue = Kernel.system("%s %s" %
- [script,cmd])
-
- self.debug "'%s' ran with exit status '%s'" %
- [cmd,rvalue]
-
-
- rvalue
- end
-
# Where is our init script?
def initscript
if defined? @initscript
@@ -109,6 +90,15 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
end
end
+ def restart
+ if @model[:hasrestart] == :true
+ command = self.initscript + " restart"
+ self.execute("restart", command)
+ else
+ super
+ end
+ end
+
def search(name)
@model[:path].each { |path|
fqname = File.join(path,name)
diff --git a/lib/puppet/type/service.rb b/lib/puppet/type/service.rb
index e52de1f05..734bff50f 100644
--- a/lib/puppet/type/service.rb
+++ b/lib/puppet/type/service.rb
@@ -251,6 +251,12 @@ module Puppet
desc "Specify a *stop* command manually."
end
+ newparam :hasrestart do
+ desc "Specify that an init script has a ``restart`` option. Otherwise,
+ the init script's ``stop`` and ``start`` methods are used."
+ newvalues(:true, :false)
+ end
+
# Retrieve the default type for the current platform.
def self.disableddefaulttype
unless defined? @defsvctype