Sha256: f3cff5aa3d80716629d27300dcf903adf1ad98b82a7bae863e6cbebf71bd66d8

Contents?: true

Size: 982 Bytes

Versions: 7

Compression:

Stored size: 982 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?
            repo.index_db_docker_manifests
          elsif repo.file?
            repo.index_db_files
          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-3.2.1.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.2.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.2.0 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.2.0.rc3 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.2.0.rc2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.2.0.rc1.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.2.0.rc1 app/lib/actions/katello/repository/filtered_index_content.rb