Sha256: 8e552cc26b954271df19f9cbc702d5b94e0ae9791da5ab1b64d6c587aa304d78

Contents?: true

Size: 1.4 KB

Versions: 19

Compression:

Stored size: 1.4 KB

Contents

module Actions
  module Katello
    module Repository
      class FilteredIndexContent < Actions::EntryAction
        input_format do
          param :id, Integer
          param :filter
          param :dependency
          param :content_type
        end

        def run
          repo = ::Katello::Repository.find(input[:id])
          if repo.puppet?
            ::Katello::PuppetModule.import_for_repository(repo)
          elsif repo.docker?
            ::Katello::DockerManifest.import_for_repository(repo)
            ::Katello::DockerTag.import_for_repository(repo)
            ::Katello::DockerManifestList.import_for_repository(repo)
          elsif repo.file?
            ::Katello::FileUnit.import_for_repository(repo)
          elsif repo.deb?
            unit_ids = search_units(repo)
            ::Katello::Deb.import_all(unit_ids, repo)
          elsif repo.yum?
            unit_ids = search_units(repo)
            if input[:content_type] == 'srpm'
              ::Katello::Srpm.import_all(unit_ids, repo)
            else
              ::Katello::Rpm.import_all(unit_ids, repo)
            end
          end
        end

        private

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
katello-3.15.3.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.3 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.1.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.0.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.0 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.0.rc2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.0.rc1.3 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.0.rc1.2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.0.rc1.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.15.0.rc1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.14.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.13.4 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.14.0 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.13.3 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.14.0.rc2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.13.2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.14.0.rc1 app/lib/actions/katello/repository/filtered_index_content.rb