Module: ForemanTasks::Concerns::ActionTriggering
- Extended by:
- ActiveSupport::Concern
- Included in:
- ArchitectureActionSubject
- Defined in:
- app/models/foreman_tasks/concerns/action_triggering.rb
Instance Method Summary collapse
- #create_action ⇒ Object
- #destroy ⇒ Object
- #destroy_action ⇒ Object
-
#disable_dynflow_hooks(&block) ⇒ Object
this can be used when HostActionSubject is used for orchestration but you want to avoid triggering more tasks by ActiveRecord callbacks within run/finalize phase of your task e.g.
- #enable_dynflow_hooks ⇒ Object
- #save!(*args) ⇒ Object
- #save_with_dynflow_task_wrap(*args) ⇒ Object
- #update_action ⇒ Object
- #update_attributes(*args) ⇒ Object
- #update_attributes!(*args) ⇒ Object
Instance Method Details
#create_action ⇒ Object
16 17 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 16 def create_action end |
#destroy ⇒ Object
36 37 38 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 36 def destroy dynflow_task_wrap(:destroy) { super } end |
#destroy_action ⇒ Object
24 25 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 24 def destroy_action end |
#disable_dynflow_hooks(&block) ⇒ Object
this can be used when HostActionSubject is used for orchestration but you want to avoid triggering more tasks by ActiveRecord callbacks within run/finalize phase of your task e.g. host.disable_dynflow_hooks { |h| h.save }
51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 51 def disable_dynflow_hooks(&block) @_disable_dynflow_hooks = true if block_given? begin block.call(self) ensure @_disable_dynflow_hooks = false end end end |
#enable_dynflow_hooks ⇒ Object
63 64 65 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 63 def enable_dynflow_hooks @_disable_dynflow_hooks = false end |
#save!(*args) ⇒ Object
32 33 34 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 32 def save!(*args) dynflow_task_wrap(:save) { super(*args) } end |
#save_with_dynflow_task_wrap(*args) ⇒ Object
28 29 30 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 28 def save_with_dynflow_task_wrap(*args) dynflow_task_wrap(:save) { save_without_dynflow_task_wrap(*args) } end |
#update_action ⇒ Object
20 21 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 20 def update_action end |
#update_attributes(*args) ⇒ Object
40 41 42 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 40 def update_attributes(*args) dynflow_task_wrap(:save) { super(*args) } end |
#update_attributes!(*args) ⇒ Object
44 45 46 |
# File 'app/models/foreman_tasks/concerns/action_triggering.rb', line 44 def update_attributes!(*args) dynflow_task_wrap(:save) { super(*args) } end |