Sha256: 496ec3d3e1637a9114db05cfbb15afcb99afbf256fa1f371e5bc51883d9326e9

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 Bytes

Contents

require 'itamae'

module Itamae
  module Resource
    class Service < Base
      define_attribute :action, default: :nothing
      define_attribute :name, type: String, default_name: true

      def start_action
        run_init_script("start")
      end

      def stop_action
        run_init_script("stop")
      end

      def restart_action
        run_init_script("restart")
      end

      def reload_action
        run_init_script("reload")
      end

      private
      def run_init_script(command)
        # TODO: Delegate to Specinfra
        run_command([init_script_path, command])
      end

      def init_script_path
        "/etc/init.d/#{name}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itamae-1.0.0.beta5 lib/itamae/resource/service.rb
itamae-1.0.0.beta4 lib/itamae/resource/service.rb