Sha256: beab48e6948db57669a26a1f9cfe2e69b84bd1fdea3447e5b447df8349729e0d

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 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?
            ::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

5 entries across 5 versions & 1 rubygems

Version Path
katello-3.13.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.13.0 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.13.0.rc2.1 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.13.0.rc2 app/lib/actions/katello/repository/filtered_index_content.rb
katello-3.13.0.rc1 app/lib/actions/katello/repository/filtered_index_content.rb