class ItamaeMitsurin::Resource::Service
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
ItamaeMitsurin::Resource::Base::new
# File lib/itamae-mitsurin/resource/service.rb, line 10 def initialize(*args) super @under = attributes.provider ? "_under_#{attributes.provider}" : "" end
Public Instance Methods
action_disable(options)
click to toggle source
# File lib/itamae-mitsurin/resource/service.rb, line 61 def action_disable(options) if current.enabled run_specinfra(:"disable_service#{@under}", attributes.name) end end
action_enable(options)
click to toggle source
# File lib/itamae-mitsurin/resource/service.rb, line 55 def action_enable(options) unless current.enabled run_specinfra(:"enable_service#{@under}", attributes.name) end end
action_reload(options)
click to toggle source
# File lib/itamae-mitsurin/resource/service.rb, line 49 def action_reload(options) if current.running run_specinfra(:"reload_service#{@under}", attributes.name) end end
action_restart(options)
click to toggle source
# File lib/itamae-mitsurin/resource/service.rb, line 45 def action_restart(options) run_specinfra(:"restart_service#{@under}", attributes.name) end
action_start(options)
click to toggle source
# File lib/itamae-mitsurin/resource/service.rb, line 33 def action_start(options) unless current.running run_specinfra(:"start_service#{@under}", attributes.name) end end
action_stop(options)
click to toggle source
# File lib/itamae-mitsurin/resource/service.rb, line 39 def action_stop(options) if current.running run_specinfra(:"stop_service#{@under}", attributes.name) end end
pre_action()
click to toggle source
# File lib/itamae-mitsurin/resource/service.rb, line 15 def pre_action case @current_action when :start, :restart attributes.running = true when :stop attributes.running = false when :enable attributes.enabled = true when :disable attributes.enabled = false end end
set_current_attributes()
click to toggle source
# File lib/itamae-mitsurin/resource/service.rb, line 28 def set_current_attributes current.running = run_specinfra(:"check_service_is_running#{@under}", attributes.name) current.enabled = run_specinfra(:"check_service_is_enabled#{@under}", attributes.name) end