Class: ForemanTasks::Task::StatusExplicator

Inherits:
Object
  • Object
show all
Defined in:
app/models/foreman_tasks/task/status_explicator.rb

Constant Summary collapse

ANY =
1
ERRONEOUS_STATUSES =
[
  { :state => 'paused', :result => ANY },
  { :state => ANY, :result => 'error' },
  { :state => ANY, :result => 'warning' },
].freeze

Instance Method Summary collapse

Instance Method Details

#is_erroneous(task) ⇒ Object



9
10
11
12
13
14
15
# File 'app/models/foreman_tasks/task/status_explicator.rb', line 9

def is_erroneous(task)
  remainder = ERRONEOUS_STATUSES.select do |status|
    (status[:state] == ANY || status[:state] == task.state) &&
      (status[:result] == ANY || status[:result] == task.result)
  end
  !remainder.empty?
end