33: def restart
34: execute([command(:lssrc), "-Ss", @resource[:name]]).each do |line|
35: args = line.split(":")
36:
37: next unless args[0] == @resource[:name]
38:
39:
40:
41: method = args[11]
42: do_refresh = case method
43: when "-K" then :true
44: when "-S" then :false
45: else self.fail("Unknown service communication method #{method}")
46: end
47:
48: begin
49: if do_refresh == :true
50: execute([command(:refresh), "-s", @resource[:name]])
51: else
52: self.stop
53: self.start
54: end
55: return :true
56: rescue Puppet::ExecutionFailure => detail
57: raise Puppet::Error.new("Unable to restart service #{@resource[:name]}, error was: #{detail}" )
58: end
59: end
60: self.fail("No such service found")
61: rescue Puppet::ExecutionFailure => detail
62: raise Puppet::Error.new("Cannot get status of #{@resource[:name]}, error was: #{detail}" )
63: end