class ForemanInventoryUpload::Async::GenerateAllReportsJob

Public Class Methods

singleton_job_name() click to toggle source
# File lib/foreman_inventory_upload/async/generate_all_reports_job.rb, line 22
def self.singleton_job_name
  name
end

Public Instance Methods

perform() click to toggle source
# File lib/foreman_inventory_upload/async/generate_all_reports_job.rb, line 4
def perform
  unless Setting[:allow_auto_inventory_upload]
    logger.debug(
      'The scheduled process is disabled due to the "allow_auto_inventory_upload"
      setting being set to false.'
    )
    return
  end

  organizations = Organization.unscoped.all

  organizations.map do |organization|
    GenerateReportJob.perform_later(ForemanInventoryUpload.generated_reports_folder, organization.id)
  end
ensure
  self.class.set(:wait => 24.hours).perform_later
end