Sha256: 064430a72daa1d17935b12be3d0820f2b9e02f44d65ff9db4aba7ba9a2ec43ca

Contents?: true

Size: 1.24 KB

Versions: 36

Compression:

Stored size: 1.24 KB

Contents

namespace :katello do
  namespace :upgrades do
    namespace '4.8' do
      desc "Regenerates metadata for library repositories that were imported"
      task :regenerate_imported_repository_metadata => ["dynflow:client", "environment"] do
        User.current = User.anonymous_admin #set a user for orchestration
        versions = Katello::ContentViewVersionImportHistory.all.map(&:content_view_version)
        repos = versions.map do |ver|
          rps = if ver.default?
                  ver.repositories
                else
                  ver.archived_repos
                end
          rps.exportable
            .map(&:library_instance_or_self)
            .select(&:using_mirrored_metadata?)
        end
        repos.flatten!
        repos.uniq!

        if repos.any?
          task = ForemanTasks.async_task(::Actions::BulkAction,
                                         ::Actions::Katello::Repository::MetadataGenerate,
                                         repos,
                                         force_publication: true)
          puts "Refreshing #{repos.count} repositories. You can monitor these on task id #{task.id}\n"
        else
          puts "No repositories found for regeneration."
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
katello-4.14.2 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.15.0 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.15.0.rc2 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.15.0.rc1 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.14.1 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.14.0 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.14.0.rc3 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.14.0.rc2 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.14.0.rc1.1 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.14.0.rc1 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.13.1 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.13.0 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.12.1 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.13.0.rc1 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.12.0 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.12.0.rc3 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.12.0.rc2 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.12.0.rc1 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.11.1 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake
katello-4.11.0 lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake