diff --git a/lib/tasks/insights.rake b/lib/tasks/insights.rake index 4db14ded..5164c33f 100644 --- a/lib/tasks/insights.rake +++ b/lib/tasks/insights.rake @@ -15,9 +15,10 @@ namespace :rh_cloud_insights do end cleaner = ForemanRhCloud::InsightsStatusCleaner.new - deleted_count = cleaner.clean(hosts_search) - - puts "Deleted #{deleted_count} insights statuses" + User.as_anonymous_admin do + deleted_count = cleaner.clean(hosts_search) + puts "Deleted #{deleted_count} insights statuses" + end end desc "Re-announce all organizations into Sources on RH cloud."