Sha256: 418fdbca55f5de455861d3c86ffd1607ce5de203967f2a0224023431469901dd

Contents?: true

Size: 1.36 KB

Versions: 49

Compression:

Stored size: 1.36 KB

Contents

module Actions
  module Katello
    module Host
      class GenerateApplicability < Actions::Base
        def queue
          ::Katello::HOST_TASKS_QUEUE
        end

        def plan(hosts, use_queue = true)
          if SETTINGS[:katello][:katello_applicability]
            plan_self(:host_ids => hosts.map(&:id))
          else
            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
        end

        def finalize
          if SETTINGS[:katello][:katello_applicability]
            input[:host_ids].each do |host_id|
              ::Katello::ApplicableHostQueue.push_host(host_id)
            end
            ::Katello::EventQueue.push_event(::Katello::Events::GenerateHostApplicability::EVENT_TYPE, 0)
          else
            input[:host_ids].each do |host_id|
              if input[:use_queue]
                ::Katello::EventQueue.push_event(::Katello::Events::ImportHostApplicability::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
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
katello-4.0.3 app/lib/actions/katello/host/generate_applicability.rb
katello-3.18.5 app/lib/actions/katello/host/generate_applicability.rb
katello-4.0.2.1 app/lib/actions/katello/host/generate_applicability.rb
katello-4.0.2 app/lib/actions/katello/host/generate_applicability.rb
katello-3.18.4 app/lib/actions/katello/host/generate_applicability.rb
katello-4.0.1.2 app/lib/actions/katello/host/generate_applicability.rb
katello-3.18.3.1 app/lib/actions/katello/host/generate_applicability.rb
katello-4.1.0.rc2.2 app/lib/actions/katello/host/generate_applicability.rb
katello-4.1.0.rc2.1 app/lib/actions/katello/host/generate_applicability.rb
katello-4.0.1.1 app/lib/actions/katello/host/generate_applicability.rb
katello-3.18.3 app/lib/actions/katello/host/generate_applicability.rb
katello-4.1.0.rc2 app/lib/actions/katello/host/generate_applicability.rb
katello-4.0.1 app/lib/actions/katello/host/generate_applicability.rb
katello-4.1.0.rc1.1 app/lib/actions/katello/host/generate_applicability.rb
katello-4.1.0.rc1 app/lib/actions/katello/host/generate_applicability.rb
katello-4.0.0 app/lib/actions/katello/host/generate_applicability.rb
katello-4.0.0.rc3.1 app/lib/actions/katello/host/generate_applicability.rb
katello-4.0.0.rc3 app/lib/actions/katello/host/generate_applicability.rb
katello-3.18.2.1 app/lib/actions/katello/host/generate_applicability.rb
katello-3.18.2 app/lib/actions/katello/host/generate_applicability.rb