Sha256: e067bacf1a4cadd6de85b029826277e87be2dd991497e92c6d18541d474992a9

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

module Actions
  module Katello
    module Repository
      class FilteredIndexContent < Actions::EntryAction
        middleware.use Actions::Middleware::KeepCurrentUser

        input_format do
          param :id, Integer
          param :filter
          param :dependency
        end

        def run
          repo = ::Katello::Repository.find(input[:id])
          unit_ids = search_units(repo)
          if repo.puppet?
            ::Katello::PuppetModule.import_for_repository(repo)
          elsif repo.docker?
            ::Katello::DockerManifest.import_for_repository(repo)
          elsif repo.file?
            ::Katello::FileUnit.import_for_repository(repo)
          else
            ::Katello::Rpm.import_all(unit_ids, :additive => true)
          end
        end

        private

        def search_units(repo)
          found = repo.unit_search(:type_ids => [repo.unit_type_id],
                                   :filters => input[:filter])
          found.map { |result| result.try(:[], :unit_id) }.compact
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-3.3.0.rc2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.3.0.rc1.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.3.0.rc1 app/lib/actions/katello/repository/filtered_index_content.rb