Class: Actions::Katello::Repository::FilteredIndexContent
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::Repository::FilteredIndexContent
- Defined in:
- app/lib/actions/katello/repository/filtered_index_content.rb
Instance Method Summary collapse
-
#run ⇒ Object
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/AbcSize.
Instance Method Details
#run ⇒ Object
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/AbcSize
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/lib/actions/katello/repository/filtered_index_content.rb', line 17 def run repo = ::Katello::Repository.find(input[:id]) if 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.generic? repo.repository_type.content_types_to_index.each do |type| type.model_class.import_for_repository(repo, content_type: type.content_type) end elsif repo.deb? if input[:import_upload_task] && input[:import_upload_task][:content_unit_href] unit_ids = [input[:import_upload_task][:content_unit_href]] elsif input[:upload_actions]&.any? { |action| action.try(:[], "content_unit_href") } uploaded_content_unit_hrefs = [] input[:upload_actions].each { |action| uploaded_content_unit_hrefs << action.try(:[], "content_unit_href") } unit_ids = uploaded_content_unit_hrefs.compact else unit_ids = [] end ::Katello::Deb.import_all(unit_ids, repo, {filtered_indexing: true}) elsif repo.yum? if input[:import_upload_task] && input[:import_upload_task][:content_unit_href] unit_ids = [input[:import_upload_task][:content_unit_href]] elsif input[:upload_actions]&.any? { |action| action.try(:[], "content_unit_href") } uploaded_content_unit_hrefs = [] input[:upload_actions].each { |action| uploaded_content_unit_hrefs << action.try(:[], "content_unit_href") } unit_ids = uploaded_content_unit_hrefs.compact else unit_ids = [] end if input[:content_type] == ::Katello::Srpm::CONTENT_TYPE ::Katello::Srpm.import_all(unit_ids, repo, {filtered_indexing: true}) else ::Katello::Rpm.import_all(unit_ids, repo, {filtered_indexing: true}) end end end |