Sha256: 41ab799262fd07a9006614607efd6128529c9bb248dcee990b24b300bc020023

Contents?: true

Size: 1.15 KB

Versions: 58

Compression:

Stored size: 1.15 KB

Contents

namespace :katello do
  namespace :upgrades do
    namespace '3.0' do
      task :delete_docker_v1_content => ["environment"] do
        print _("Deleting repositories that only contain Docker v1 content....")
        User.current = User.anonymous_admin
        docker_repositories = Katello::Repository.where(:content_type => Katello::Repository::DOCKER_TYPE, :library_instance_id => nil)

        v1_repos = docker_repositories.select do |repo|
          docker_images_count = Katello.pulp_server.extensions.repository.docker_images(repo.pulp_id).size
          repo_units_count = Katello.pulp_server.extensions.repository.unit_search(repo.pulp_id).size
          docker_images_count > 0 && docker_images_count == repo_units_count
        end

        v1_repos.each do |v1_repo|
          v1_repo.clones.each do |clone|
            ForemanTasks.sync_task(::Actions::Katello::Repository::Destroy, clone, :planned_destroy => true)
          end
          ForemanTasks.sync_task(::Actions::Katello::Repository::Destroy, v1_repo, :planned_destroy => true)
        end

        puts _("Done")
        Rake::Task["katello:delete_orphaned_content"].invoke
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
katello-3.8.1 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.7.1.1 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.7.1 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.8.0 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.8.0.rc3 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.8.0.rc2 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.7.0 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.8.0.rc1 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.7.0.rc2 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.7.0.rc1 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.5.2 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.6.0 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.6.0.1.rc2 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.6.0.rc2 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.6.0.rc1 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.5.1.1 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.5.1 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.5.0.1 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.5.0 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake
katello-3.5.0.rc2 lib/katello/tasks/upgrades/3.0/delete_docker_v1_content.rake