Class: Wakame::Actions::ReloadService
- Inherits:
-
Wakame::Action
- Object
- Wakame::Action
- Wakame::Actions::ReloadService
- Defined in:
- lib/wakame/actions/reload_service.rb
Constant Summary
Constants included from AttributeHelper
AttributeHelper::CLASS_TYPE_KEY, AttributeHelper::CONVERT_CLASSES, AttributeHelper::PRIMITIVE_CLASSES
Instance Attribute Summary
Attributes inherited from Wakame::Action
Instance Method Summary collapse
-
#initialize(svc) ⇒ ReloadService
constructor
A new instance of ReloadService.
- #on_failed ⇒ Object
- #run ⇒ Object
Methods inherited from Wakame::Action
#acquire_lock, #actor_request, #agent_monitor, #all_subactions_complete?, #flush_subactions, #master, #notes, #notify, #on_canceled, #service_cluster, #status=, #subactions, #sync_actor_request, #trigger_action, #walk_subactions
Methods included from ThreadImmutable
#bind_thread, included, #target_thread, #target_thread?, #thread_check
Methods included from AttributeHelper
#dump_attrs, #retrieve_attr_attribute
Constructor Details
#initialize(svc) ⇒ ReloadService
Returns a new instance of ReloadService.
4 5 6 |
# File 'lib/wakame/actions/reload_service.rb', line 4 def initialize(svc) @svc = svc end |
Instance Method Details
#on_failed ⇒ Object
25 26 27 28 29 |
# File 'lib/wakame/actions/reload_service.rb', line 25 def on_failed StatusDB. { @svc.update_status(Service::STATUS_FAIL) } end |
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/wakame/actions/reload_service.rb', line 8 def run # Skip to act when the service is having below status. if @svc.monitor_status != Service::STATUS_ONLINE raise "Canceled as the service is being or already ONLINE: #{@svc.resource.class}" end StatusDB. { @svc.update_status(Service::STATUS_RELOADING) } @svc.resource.reload(@svc, self) StatusDB. { @svc.update_status(Service::STATUS_RUNNING) } end |