Sha256: bf643facbeff104c18433f28776a25741ecfd84bb20315ad269e4c67a23b9878

Contents?: true

Size: 1004 Bytes

Versions: 7

Compression:

Stored size: 1004 Bytes

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?
            repo.index_db_puppet_modules
          elsif repo.docker?
            # have to call Repository#index_db_docker_images to get the repo's tags
            repo.index_db_docker_images
          else
            ::Katello::Rpm.import_all(unit_ids, 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

7 entries across 7 versions & 1 rubygems

Version Path
katello-2.4.5 app/lib/actions/katello/repository/filtered_index_content.rb
katello-2.4.4 app/lib/actions/katello/repository/filtered_index_content.rb
katello-2.4.3 app/lib/actions/katello/repository/filtered_index_content.rb
katello-2.4.2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-2.4.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-2.4.0 app/lib/actions/katello/repository/filtered_index_content.rb
katello-2.4.0.rc3 app/lib/actions/katello/repository/filtered_index_content.rb