Sha256: 7c96e18ee0311191f70fe0c43b2e91e4207b7794bb6c03dcef5f37f20624987b

Contents?: true

Size: 931 Bytes

Versions: 15

Compression:

Stored size: 931 Bytes

Contents

module Katello
  class PurposeRoleStatus < HostStatus::Status
    VALID = 0
    INVALID = 1
    UNKNOWN = 2

    def self.status_name
      N_('Role')
    end

    def self.humanized_name
      'purpose_role'
    end

    def to_label(_options = {})
      case status
      when VALID
        N_('Matched')
      when INVALID
        N_('Mismatched')
      else
        N_('Unknown')
      end
    end

    def to_status(options = {})
      return UNKNOWN unless relevant?

      status_override = options[:status_override]

      return INVALID if status_override == false

      return VALID if status_override || consumer.compliant_role?

      INVALID
    end

    def relevant?(_options = {})
      host.subscription_facet.try(:uuid)
    end

    def substatus?(_options = {})
      true
    end

    def consumer
      Katello::Candlepin::Consumer.new(host.subscription_facet.uuid, host.organization.label)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
katello-3.11.2 app/models/katello/purpose_role_status.rb
katello-3.10.2 app/models/katello/purpose_role_status.rb
katello-3.10.1.1 app/models/katello/purpose_role_status.rb
katello-3.10.1 app/models/katello/purpose_role_status.rb
katello-3.11.1 app/models/katello/purpose_role_status.rb
katello-3.11.0 app/models/katello/purpose_role_status.rb
katello-3.11.0.rc2 app/models/katello/purpose_role_status.rb
katello-3.11.0.rc1 app/models/katello/purpose_role_status.rb
katello-3.10.0 app/models/katello/purpose_role_status.rb
katello-3.10.0.rc1.1 app/models/katello/purpose_role_status.rb
katello-3.9.1 app/models/katello/purpose_role_status.rb
katello-3.10.0.rc1 app/models/katello/purpose_role_status.rb
katello-3.9.0 app/models/katello/purpose_role_status.rb
katello-3.9.0.rc2 app/models/katello/purpose_role_status.rb
katello-3.9.0.rc1 app/models/katello/purpose_role_status.rb