Sha256: 40c77b273649594e15f21bd3a350c8740e90b2f0fea196e10739177493f8aeab

Contents?: true

Size: 899 Bytes

Versions: 7

Compression:

Stored size: 899 Bytes

Contents

module Actions
  module Katello
    module Host
      class GenerateApplicability < Actions::Base
        middleware.use Actions::Middleware::KeepCurrentUser

        def plan(hosts, use_queue = true)
          uuids = hosts.map { |host| host.content_facet.try(:uuid) }.compact
          unless uuids.empty?
            plan_action(Pulp::Consumer::GenerateApplicability, :uuids => uuids)
            plan_self(:host_ids => hosts.map(&:id), :use_queue => use_queue)
          end
        end

        def finalize
          input[:host_ids].each do |host_id|
            if input[:use_queue]
              ::Katello::EventQueue.push_event(::Katello::Events::ImportHostErrata::EVENT_TYPE, host_id)
            else
              host = ::Host.find(host_id)
              host.content_facet.try(:import_applicability, true) if host
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
katello-3.2.1.1 app/lib/actions/katello/host/generate_applicability.rb
katello-3.2.1 app/lib/actions/katello/host/generate_applicability.rb
katello-3.2.0 app/lib/actions/katello/host/generate_applicability.rb
katello-3.2.0.rc3 app/lib/actions/katello/host/generate_applicability.rb
katello-3.2.0.rc2 app/lib/actions/katello/host/generate_applicability.rb
katello-3.2.0.rc1.1 app/lib/actions/katello/host/generate_applicability.rb
katello-3.2.0.rc1 app/lib/actions/katello/host/generate_applicability.rb