Sha256: 092bd2e5a6d538e98f018b890c02483affb204a640e888be3e32842aa494a8cb

Contents?: true

Size: 825 Bytes

Versions: 105

Compression:

Stored size: 825 Bytes

Contents

namespace :katello do
  desc "Remove orphaned and unneeded content/repos from a smart proxy.\
        Run with SMART_PROXY_ID=1 to run for a single smart proxy."
  task :delete_orphaned_content => ["dynflow:client"] do
    User.current = User.anonymous_admin
    smart_proxy_id = ENV['SMART_PROXY_ID']
    if smart_proxy_id
      proxy = SmartProxy.find(smart_proxy_id)
      remove_orphan(proxy)
    else
      SmartProxy.with_content.uniq.reverse_each do |smart_proxy|
        remove_orphan(smart_proxy)
      end
    end
  end

  def remove_orphan(proxy)
    ForemanTasks.async_task(Actions::Katello::OrphanCleanup::RemoveOrphans, proxy)
    puts _("Orphaned content deletion started in background.")
  rescue RuntimeError => e
    Rails.logger.error "Smart proxy with ID #{proxy.id} may be down: #{e}"
    exit
  end
end

Version data entries

105 entries across 105 versions & 1 rubygems

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