Sha256: 3f040952a787266a1aa323e91702ad027d2c6e946204587c99bd55433e3472fa

Contents?: true

Size: 952 Bytes

Versions: 2

Compression:

Stored size: 952 Bytes

Contents

module Actions
  module ElasticSearch
    module Repository
      class FilteredIndexContent < ElasticSearch::Abstract
        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

2 entries across 2 versions & 1 rubygems

Version Path
katello-2.4.0.rc2 app/lib/actions/elastic_search/repository/filtered_index_content.rb
katello-2.4.0.rc1 app/lib/actions/elastic_search/repository/filtered_index_content.rb