Exception: ForemanTasks::Lock::LockConflict
- Inherits:
-
StandardError
- Object
- StandardError
- ForemanTasks::Lock::LockConflict
- Defined in:
- app/models/foreman_tasks/lock.rb
Instance Attribute Summary collapse
-
#conflicting_locks ⇒ Object
readonly
Returns the value of attribute conflicting_locks.
-
#required_lock ⇒ Object
readonly
Returns the value of attribute required_lock.
Instance Method Summary collapse
-
#initialize(required_lock, conflicting_locks) ⇒ LockConflict
constructor
A new instance of LockConflict.
Constructor Details
#initialize(required_lock, conflicting_locks) ⇒ LockConflict
Returns a new instance of LockConflict.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/foreman_tasks/lock.rb', line 5 def initialize(required_lock, conflicting_locks) header = <<-HEADER.gsub(/^\s+\| ?/, '') | #{_('Required lock is already taken by other running tasks.')} | #{_('Please inspect their state, fix their errors and resume them.')} | | #{_('Conflicts with tasks:')} HEADER url_helpers = ::Rails.application.routes.url_helpers conflicting_tasks = conflicting_locks .map(&:task) .uniq .map { |task| "- #{Setting['foreman_url'] + url_helpers.foreman_tasks_task_path(task)}" } .join("\n") super header + conflicting_tasks @required_lock = required_lock @conflicting_locks = conflicting_locks end |
Instance Attribute Details
#conflicting_locks ⇒ Object (readonly)
Returns the value of attribute conflicting_locks.
4 5 6 |
# File 'app/models/foreman_tasks/lock.rb', line 4 def conflicting_locks @conflicting_locks end |
#required_lock ⇒ Object (readonly)
Returns the value of attribute required_lock.
4 5 6 |
# File 'app/models/foreman_tasks/lock.rb', line 4 def required_lock @required_lock end |