summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/service
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/provider/service')
-rw-r--r--lib/puppet/provider/service/daemontools.rb8
-rw-r--r--lib/puppet/provider/service/gentoo.rb8
-rwxr-xr-xlib/puppet/provider/service/redhat.rb8
-rwxr-xr-xlib/puppet/provider/service/smf.rb4
-rwxr-xr-xlib/puppet/provider/service/src.rb8
5 files changed, 9 insertions, 27 deletions
diff --git a/lib/puppet/provider/service/daemontools.rb b/lib/puppet/provider/service/daemontools.rb
index f5f2607e3..934e96aea 100644
--- a/lib/puppet/provider/service/daemontools.rb
+++ b/lib/puppet/provider/service/daemontools.rb
@@ -125,16 +125,14 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
end
def setupservice
- begin
if resource[:manifest]
Puppet.notice "Configuring #{resource[:name]}"
command = [ resource[:manifest], resource[:name] ]
#texecute("setupservice", command)
rv = system("#{command}")
end
- rescue Puppet::ExecutionFailure => detail
+ rescue Puppet::ExecutionFailure => detail
raise Puppet::Error.new( "Cannot config #{self.service} to enable it: #{detail}" )
- end
end
def enabled?
@@ -149,7 +147,6 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
end
def enable
- begin
if ! FileTest.directory?(self.daemon)
Puppet.notice "No daemon dir, calling setupservice for #{resource[:name]}"
self.setupservice
@@ -160,9 +157,8 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
File.symlink(self.daemon, self.service)
end
end
- rescue Puppet::ExecutionFailure => detail
+ rescue Puppet::ExecutionFailure => detail
raise Puppet::Error.new( "No daemon directory found for #{self.service}")
- end
end
def disable
diff --git a/lib/puppet/provider/service/gentoo.rb b/lib/puppet/provider/service/gentoo.rb
index a3d477751..109524bc0 100644
--- a/lib/puppet/provider/service/gentoo.rb
+++ b/lib/puppet/provider/service/gentoo.rb
@@ -18,11 +18,9 @@ Puppet::Type.type(:service).provide :gentoo, :parent => :init do
end
def disable
- begin
output = update :del, @resource[:name], :default
- rescue Puppet::ExecutionFailure
+ rescue Puppet::ExecutionFailure
raise Puppet::Error, "Could not disable #{self.name}: #{output}"
- end
end
def enabled?
@@ -45,11 +43,9 @@ Puppet::Type.type(:service).provide :gentoo, :parent => :init do
end
def enable
- begin
output = update :add, @resource[:name], :default
- rescue Puppet::ExecutionFailure
+ rescue Puppet::ExecutionFailure
raise Puppet::Error, "Could not enable #{self.name}: #{output}"
- end
end
end
diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb
index b31faa586..3a25db3ac 100755
--- a/lib/puppet/provider/service/redhat.rb
+++ b/lib/puppet/provider/service/redhat.rb
@@ -22,11 +22,9 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
# Remove the symlinks
def disable
- begin
output = chkconfig(@resource[:name], :off)
- rescue Puppet::ExecutionFailure
+ rescue Puppet::ExecutionFailure
raise Puppet::Error, "Could not disable #{self.name}: #{output}"
- end
end
def enabled?
@@ -48,11 +46,9 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
# Don't support them specifying runlevels; always use the runlevels
# in the init scripts.
def enable
- begin
output = chkconfig(@resource[:name], :on)
- rescue Puppet::ExecutionFailure => detail
+ rescue Puppet::ExecutionFailure => detail
raise Puppet::Error, "Could not enable #{self.name}: #{detail}"
- end
end
def initscript
diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb
index 0407c8479..ca7af9449 100755
--- a/lib/puppet/provider/service/smf.rb
+++ b/lib/puppet/provider/service/smf.rb
@@ -19,7 +19,6 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
commands :svccfg => "/usr/sbin/svccfg"
def setupservice
- begin
if resource[:manifest]
[command(:svcs), "-l", @resource[:name]]
if $CHILD_STATUS.exitstatus == 1
@@ -27,9 +26,8 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
svccfg :import, resource[:manifest]
end
end
- rescue Puppet::ExecutionFailure => detail
+ rescue Puppet::ExecutionFailure => detail
raise Puppet::Error.new( "Cannot config #{self.service} to enable it: #{detail}" )
- end
end
def enable
diff --git a/lib/puppet/provider/service/src.rb b/lib/puppet/provider/service/src.rb
index 135edcb65..aed88d531 100755
--- a/lib/puppet/provider/service/src.rb
+++ b/lib/puppet/provider/service/src.rb
@@ -31,7 +31,6 @@ Puppet::Type.type(:service).provide :src, :parent => :base do
end
def restart
- begin
execute([command(:lssrc), "-Ss", @resource[:name]]).each do |line|
args = line.split(":")
@@ -59,13 +58,11 @@ Puppet::Type.type(:service).provide :src, :parent => :base do
end
end
self.fail("No such service found")
- rescue Puppet::ExecutionFailure => detail
+ rescue Puppet::ExecutionFailure => detail
raise Puppet::Error.new("Cannot get status of #{@resource[:name]}, error was: #{detail}" )
- end
end
def status
- begin
execute([command(:lssrc), "-s", @resource[:name]]).each do |line|
args = line.split
@@ -82,9 +79,8 @@ Puppet::Type.type(:service).provide :src, :parent => :base do
return state
end
self.fail("No such service found")
- rescue Puppet::ExecutionFailure => detail
+ rescue Puppet::ExecutionFailure => detail
raise Puppet::Error.new("Cannot get status of #{@resource[:name]}, error was: #{detail}" )
- end
end
end