fujin (owner)

Revisions

gist: 189654 Download_button fork
public
Public Clone URL: git://gist.github.com/189654.git
Embed All Files: show embed
service.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
def action_stop
        if @current_resource.running
          Chef::Log.debug("#{@new_resource}: attempting to stop")
          status = stop_service()
          if status
            Chef::Log.info("#{@new_resource}: stopped successfully")
          end
        else
          Chef::Log.debug("#{@new_resource}: not stopping, already stopped")
        end
      end
      
      def action_restart
        Chef::Log.debug("#{@new_resource}: attempting to restart")
        status = restart_service()
        if status
          Chef::Log.info("#{@new_resource}: restarted successfully")
        end
      end
 
      def action_reload
        unless @new_resource.supports[:reload] or @new_resource.reload_command
          raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :reload"
        else
          if @current_resource.running
            Chef::Log.debug("#{@new_resource}: attempting to reload")
            status = reload_service()
            if status
              Chef::Log.info("#{@new_resource}: reloaded successfully")
            end
          end
        end
      end