Sha256: 7c961b6a7b6293b43f65db31061218ad3fe622dc93977bcdada8fc3c89c8f0ed

Contents?: true

Size: 1.43 KB

Versions: 12

Compression:

Stored size: 1.43 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 = {})
      traces = host.host_traces.reload.pluck(:app_type)
      traces.delete(Katello::HostTracer::TRACE_APP_TYPE_SESSION)

      if traces.include?(Katello::HostTracer::TRACE_APP_TYPE_STATIC)
        REQUIRE_REBOOT
      elsif !traces.empty?
        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

12 entries across 12 versions & 1 rubygems

Version Path
katello-4.14.2 app/models/katello/trace_status.rb
katello-4.15.0 app/models/katello/trace_status.rb
katello-4.15.0.rc2 app/models/katello/trace_status.rb
katello-4.15.0.rc1 app/models/katello/trace_status.rb
katello-4.14.1 app/models/katello/trace_status.rb
katello-4.14.0 app/models/katello/trace_status.rb
katello-4.14.0.rc3 app/models/katello/trace_status.rb
katello-4.14.0.rc2 app/models/katello/trace_status.rb
katello-4.14.0.rc1.1 app/models/katello/trace_status.rb
katello-4.14.0.rc1 app/models/katello/trace_status.rb
katello-4.13.1 app/models/katello/trace_status.rb
katello-4.13.0 app/models/katello/trace_status.rb