Class: Katello::HostTracer

Inherits:
Model
  • Object
show all
Includes:
Authorization::HostTracer
Defined in:
app/models/katello/host_tracer.rb

Constant Summary collapse

TRACE_APP_TYPE_STATIC =
'static'.freeze
TRACE_APP_TYPE_SESSION =
'session'.freeze
TRACE_APP_TYPE_DAEMON =
'daemon'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#destroy!

Class Method Details

.helpers_for(traces) ⇒ Object



37
38
39
40
41
42
43
# File 'app/models/katello/host_tracer.rb', line 37

def self.helpers_for(traces)
  if traces.any?(&:reboot_required?)
    ['reboot']
  else
    traces.map(&:restart_command).compact.uniq
  end
end

Instance Method Details

#reboot_required?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/models/katello/host_tracer.rb', line 22

def reboot_required?
  self.app_type == TRACE_APP_TYPE_STATIC
end

#restart_commandObject



26
27
28
29
30
31
32
33
34
35
# File 'app/models/katello/host_tracer.rb', line 26

def restart_command
  case self.app_type
  when TRACE_APP_TYPE_STATIC
    'reboot'
  when TRACE_APP_TYPE_SESSION
    nil
  else
    self.helper
  end
end