Sha256: bc236ae09cfd59de2ec48e499e5670dbc89bcf93d3935ad63a67b0ebad71f0d5

Contents?: true

Size: 1.69 KB

Versions: 9

Compression:

Stored size: 1.69 KB

Contents

module Katello
  module Concerns
    module SubscriptionFacetHostExtensions
      extend ActiveSupport::Concern
      include ForemanTasks::Concerns::ActionTriggering

      included do
        SUBSCRIPTION_STATUS_MAP = {
          :valid => Katello::SubscriptionStatus::VALID,
          :partial => Katello::SubscriptionStatus::PARTIAL,
          :invalid => Katello::SubscriptionStatus::INVALID,
          :unknown => Katello::SubscriptionStatus::UNKNOWN
        }

        has_one :subscription_facet, :class_name => '::Katello::Host::SubscriptionFacet', :foreign_key => :host_id, :inverse_of => :host, :dependent =>  :destroy

        has_one :subscription_status_object, :class_name => 'Katello::SubscriptionStatus', :foreign_key => 'host_id'
        scoped_search :on => :status, :in => :subscription_status_object, :rename => :subscription_status,
                      :complete_value => SUBSCRIPTION_STATUS_MAP

        attr_accessible :subscription_facet_attributes

        scoped_search :on => :release_version, :in => :subscription_facet, :complete_value => true
        scoped_search :on => :autoheal, :in => :subscription_facet, :complete_value => true
        scoped_search :on => :service_level, :in => :subscription_facet, :complete_value => true
        scoped_search :on => :last_checkin, :in => :subscription_facet, :complete_value => true
        scoped_search :on => :registered_at, :in => :subscription_facet, :rename => :registered_at
        scoped_search :on => :uuid, :in => :subscription_facet, :rename => :subscription_uuid
      end

      def update_action
        if subscription_facet.try(:backend_update_needed?)
          ::Actions::Katello::Host::Update
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-3.0.2 app/models/katello/concerns/subscription_facet_host_extensions.rb
katello-3.0.1 app/models/katello/concerns/subscription_facet_host_extensions.rb
katello-3.0.0 app/models/katello/concerns/subscription_facet_host_extensions.rb
katello-3.0.0.rc7 app/models/katello/concerns/subscription_facet_host_extensions.rb
katello-3.0.0.rc5 app/models/katello/concerns/subscription_facet_host_extensions.rb
katello-3.0.0.rc4 app/models/katello/concerns/subscription_facet_host_extensions.rb
katello-3.0.0.rc3 app/models/katello/concerns/subscription_facet_host_extensions.rb
katello-3.0.0.rc2 app/models/katello/concerns/subscription_facet_host_extensions.rb
katello-3.0.0.rc1 app/models/katello/concerns/subscription_facet_host_extensions.rb