Sha256: c070e12682e73465db81498181f4287bcf0a1bc5440cc04f0f889df939638cc3

Contents?: true

Size: 1.03 KB

Versions: 21

Compression:

Stored size: 1.03 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)
          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

21 entries across 21 versions & 1 rubygems

Version Path
katello-3.5.2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.5.1.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.5.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.5.0.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.5.0 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.5.0.rc2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.5.0.rc1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.4.5 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.4.4 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.4.2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.4.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.4.0.2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.4.0.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.3.2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.4.0 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.4.0.rc2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.4.0.rc1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.3.1.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.3.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.3.0.1 app/lib/actions/katello/repository/filtered_index_content.rb