Sha256: 0d613d46de0080f8cf386353282e3752b0108ed23e36395d7a577fcf629a360b

Contents?: true

Size: 1.28 KB

Versions: 75

Compression:

Stored size: 1.28 KB

Contents

module Katello
  class TraceStatus < HostStatus::Status
    REQUIRE_REBOOT = 2
    REQUIRE_PROCESS_RESTART = 1
    UP_TO_DATE = 0

    def self.status_name
      N_("Traces")
    end

    def to_label(_options = {})
      case to_status
      when REQUIRE_REBOOT
        N_("Reboot required")
      when REQUIRE_PROCESS_RESTART
        N_("One or more processes require restarting")
      when UP_TO_DATE
        N_("No processes require restarting")
      else
        N_("Unknown traces status")
      end
    end

    def to_global(_options = {})
      case to_status
      when REQUIRE_REBOOT
        ::HostStatus::Global::ERROR
      when REQUIRE_PROCESS_RESTART
        ::HostStatus::Global::WARN
      when UP_TO_DATE
        ::HostStatus::Global::OK
      else
        ::HostStatus::Global::WARN
      end
    end

    def to_status(_options = {})
      if host.host_traces.where(:app_type => "static").any?
        REQUIRE_REBOOT
      elsif host.host_traces.where.not(:app_type => "session").any?
        REQUIRE_PROCESS_RESTART
      else
        UP_TO_DATE
      end
    end

    def relevant?(_options = {})
      # traces cannot be reported from hosts lower than el7
      return false if host.operatingsystem.try(:major).to_i.between?(1, 6)
      host.content_facet.try(:uuid)
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
katello-3.13.0 app/models/katello/trace_status.rb
katello-3.13.0.rc2.1 app/models/katello/trace_status.rb
katello-3.13.0.rc2 app/models/katello/trace_status.rb
katello-3.12.3 app/models/katello/trace_status.rb
katello-3.12.2 app/models/katello/trace_status.rb
katello-3.13.0.rc1 app/models/katello/trace_status.rb
katello-3.12.1 app/models/katello/trace_status.rb
katello-3.11.2 app/models/katello/trace_status.rb
katello-3.10.2 app/models/katello/trace_status.rb
katello-3.12.0 app/models/katello/trace_status.rb
katello-3.12.0.rc2 app/models/katello/trace_status.rb
katello-3.10.1.1 app/models/katello/trace_status.rb
katello-3.12.0.rc1 app/models/katello/trace_status.rb
katello-3.10.1 app/models/katello/trace_status.rb
katello-3.11.1 app/models/katello/trace_status.rb
katello-3.11.0 app/models/katello/trace_status.rb
katello-3.11.0.rc2 app/models/katello/trace_status.rb
katello-3.11.0.rc1 app/models/katello/trace_status.rb
katello-3.10.0 app/models/katello/trace_status.rb
katello-3.10.0.rc1.1 app/models/katello/trace_status.rb