Sha256: f32a9e1699993677b8a812ea77a95874253c74c535ffb4afb554dcd80f1db6c1
Contents?: true
Size: 903 Bytes
Versions: 31
Compression:
Stored size: 903 Bytes
Contents
load "#{Katello::Engine.root}/lib/katello/tasks/common.rake" 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 => ["environment", "disable_dynflow"] 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
31 entries across 31 versions & 1 rubygems