Sha256: 97625e89cb5fe9edce7b21756853f4ba7c5fb1f29011530bd519aa332bcb703c

Contents?: true

Size: 1.32 KB

Versions: 15

Compression:

Stored size: 1.32 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.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

15 entries across 15 versions & 1 rubygems

Version Path
katello-3.16.2 app/models/katello/trace_status.rb
katello-3.16.1.2 app/models/katello/trace_status.rb
katello-3.16.1.1 app/models/katello/trace_status.rb
katello-3.16.1 app/models/katello/trace_status.rb
katello-3.16.0 app/models/katello/trace_status.rb
katello-3.16.0.rc5.1 app/models/katello/trace_status.rb
katello-3.16.0.rc5 app/models/katello/trace_status.rb
katello-3.16.0.rc4.1 app/models/katello/trace_status.rb
katello-3.16.0.rc4 app/models/katello/trace_status.rb
katello-3.16.0.rc3.1 app/models/katello/trace_status.rb
katello-3.16.0.rc3 app/models/katello/trace_status.rb
katello-3.16.0.rc2.1 app/models/katello/trace_status.rb
katello-3.16.0.rc2 app/models/katello/trace_status.rb
katello-3.16.0.rc1.1 app/models/katello/trace_status.rb
katello-3.16.0.rc1 app/models/katello/trace_status.rb