Sha256: 24d4262a7025b5d63e70f6ae623bb8b46254212a6ff2be1defa6b5023e48d005

Contents?: true

Size: 1.33 KB

Versions: 103

Compression:

Stored size: 1.33 KB

Contents

module Katello
  class TraceStatus < HostStatus::Status
    REQUIRE_REBOOT = 2
    REQUIRE_PROCESS_RESTART = 1
    UP_TO_DATE = 0
    UNKNOWN = -1
    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.reboot_required.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&.tracer_installed?
      host.content_facet.try(:uuid).present?
    end
  end
end

Version data entries

103 entries across 103 versions & 1 rubygems

Version Path
katello-3.17.0.rc2.1 app/models/katello/trace_status.rb
katello-3.17.0.rc2 app/models/katello/trace_status.rb
katello-3.17.0.rc1 app/models/katello/trace_status.rb