Sha256: ac7af39ba9d075497ee019302bfcfc0f9f10d31f74b5736d4018bb2d31f78f78

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

namespace :rh_cloud_insights do
  desc "Synchronize Insights hosts hits"
  task sync: [:environment, 'dynflow:client'] do
    ForemanTasks.sync_task(InsightsCloud::Async::InsightsFullSync, Organization.unscoped.all)
    puts "Synchronized Insights hosts hits data"
  end

  desc "Remove insights client report statuses by searching on host criteria"
  task clean_statuses: [:environment] do
    hosts_search = ENV['SEARCH']

    if hosts_search.empty?
      puts 'Must specify SEARCH= criteria for hosts search'
      next
    end

    cleaner = ForemanRhCloud::InsightsStatusCleaner.new
    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."
  task announce_to_sources: [:environment] do
    logger = Logging::Logger.new(STDOUT)
    Organization.unscoped.each do |org|
      presence = ForemanRhCloud::CloudPresence.new(org, logger)
      presence.announce_to_sources
    rescue StandardError => ex
      logger.warn(ex)
    end

    logger.info('Reannounced all organizations')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
foreman_rh_cloud-10.0.3 lib/tasks/insights.rake
foreman_rh_cloud-11.0.3 lib/tasks/insights.rake
foreman_rh_cloud-11.0.2 lib/tasks/insights.rake
foreman_rh_cloud-11.0.1 lib/tasks/insights.rake
foreman_rh_cloud-11.0.0 lib/tasks/insights.rake
foreman_rh_cloud-10.0.2 lib/tasks/insights.rake
foreman_rh_cloud-10.0.1 lib/tasks/insights.rake