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.7.1 lib/katello/tasks/delete_orphaned_content.rake
katello-4.6.2.1 lib/katello/tasks/delete_orphaned_content.rake
katello-4.6.2 lib/katello/tasks/delete_orphaned_content.rake
katello-4.7.0 lib/katello/tasks/delete_orphaned_content.rake
katello-4.6.1 lib/katello/tasks/delete_orphaned_content.rake
katello-4.7.0.rc2 lib/katello/tasks/delete_orphaned_content.rake
katello-4.7.0.rc1 lib/katello/tasks/delete_orphaned_content.rake
katello-4.4.2.2 lib/katello/tasks/delete_orphaned_content.rake
katello-4.4.2.1 lib/katello/tasks/delete_orphaned_content.rake
katello-4.4.2 lib/katello/tasks/delete_orphaned_content.rake
katello-4.5.1 lib/katello/tasks/delete_orphaned_content.rake
katello-4.6.0 lib/katello/tasks/delete_orphaned_content.rake
katello-4.6.0.rc2 lib/katello/tasks/delete_orphaned_content.rake
katello-4.6.0.rc1 lib/katello/tasks/delete_orphaned_content.rake
katello-4.5.0 lib/katello/tasks/delete_orphaned_content.rake
katello-4.5.0.rc2 lib/katello/tasks/delete_orphaned_content.rake
katello-4.4.1 lib/katello/tasks/delete_orphaned_content.rake
katello-4.5.0.rc1 lib/katello/tasks/delete_orphaned_content.rake
katello-4.4.0.2 lib/katello/tasks/delete_orphaned_content.rake
katello-4.4.0.1 lib/katello/tasks/delete_orphaned_content.rake