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.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/foreman_tasks/lock.rb', line 15 def initialize(required_lock, conflicting_locks) header = _("Required lock is already taken by other running tasks.") header << "\n" header << _("Please inspect their state, fix their errors and resume them.") header << "\n\n" header << _("Required lock: %s") % required_lock.name header << "\n" header << _("Conflicts with tasks:") header << "\n" 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.
14 15 16 |
# File 'app/models/foreman_tasks/lock.rb', line 14 def conflicting_locks @conflicting_locks end |
#required_lock ⇒ Object (readonly)
Returns the value of attribute required_lock.
14 15 16 |
# File 'app/models/foreman_tasks/lock.rb', line 14 def required_lock @required_lock end |