Sha256: 72db264f1419ff839b6e3521091ec70ede2ee23b6b00127f0df0b6b9470bfb87

Contents?: true

Size: 1.08 KB

Versions: 53

Compression:

Stored size: 1.08 KB

Contents

module Katello
  class HostTracer < Katello::Model
    include Katello::Authorization::HostTracer

    belongs_to :host, :inverse_of => :host_traces, :class_name => '::Host::Managed'

    scope :reboot_required, -> { where(app_type: 'static') }
    scope :selectable, -> { where.not(app_type: 'session') }

    validates :application, :length => {:maximum => 255}, :presence => true
    validates :app_type, :length => {:maximum => 255}, :presence => true

    scoped_search :on => :id, :only_explicit => true
    scoped_search :on => :application, :complete_value => true
    scoped_search :on => :app_type, :complete_value => true
    scoped_search :on => :helper, :complete_value => true

    def reboot_required?
      self.app_type == 'static'
    end

    def restart_command
      case self.app_type
      when 'static'
        'reboot'
      when 'session'
        nil
      else
        self.helper
      end
    end

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

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
katello-4.11.1 app/models/katello/host_tracer.rb
katello-4.11.0 app/models/katello/host_tracer.rb
katello-4.11.0.rc2 app/models/katello/host_tracer.rb
katello-4.11.0.rc1 app/models/katello/host_tracer.rb
katello-4.10.0 app/models/katello/host_tracer.rb
katello-4.9.2 app/models/katello/host_tracer.rb
katello-4.10.0.rc2 app/models/katello/host_tracer.rb
katello-4.10.0.rc1 app/models/katello/host_tracer.rb
katello-4.8.4 app/models/katello/host_tracer.rb
katello-4.9.1 app/models/katello/host_tracer.rb
katello-4.8.3 app/models/katello/host_tracer.rb
katello-4.9.0 app/models/katello/host_tracer.rb
katello-4.7.6 app/models/katello/host_tracer.rb
katello-4.8.2 app/models/katello/host_tracer.rb
katello-4.9.0.rc2 app/models/katello/host_tracer.rb
katello-4.9.0.rc1 app/models/katello/host_tracer.rb
katello-4.8.1 app/models/katello/host_tracer.rb
katello-4.7.5 app/models/katello/host_tracer.rb
katello-4.8.0 app/models/katello/host_tracer.rb
katello-4.8.0.rc2 app/models/katello/host_tracer.rb