Module: Actions::Helpers::Lock
- Included in:
- EntryAction
- Defined in:
- app/lib/actions/helpers/lock.rb
Instance Method Summary collapse
- #exclusive_lock!(resource) ⇒ Object
- #link!(resource) ⇒ Object
- #lock!(resource, *_lock_names) ⇒ Object
Instance Method Details
#exclusive_lock!(resource) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'app/lib/actions/helpers/lock.rb', line 5 def exclusive_lock!(resource) phase! Dynflow::Action::Plan parent_lock = ::ForemanTasks::Lock.for_resource(resource).where(:task_id => task.self_and_parents.map(&:id)).first if parent_lock ForemanTasks::Link.(resource, task) parent_lock else ::ForemanTasks::Lock.exclusive!(resource, task) end end |
#link!(resource) ⇒ Object
23 24 25 26 |
# File 'app/lib/actions/helpers/lock.rb', line 23 def link!(resource) phase! Dynflow::Action::Plan ::ForemanTasks::Link.link!(resource, task) end |
#lock!(resource, *_lock_names) ⇒ Object
17 18 19 20 |
# File 'app/lib/actions/helpers/lock.rb', line 17 def lock!(resource, *_lock_names) Foreman::Deprecation.deprecation_warning('2.4', 'locking in foreman-tasks was reworked, please use a combination of exclusive_lock! and link! instead.') exclusive_lock!(resource) end |