Sha256: ce3b46aab79595d00e997c4777dae9705583a913fd428410d8ebca5fc6361fe1

Contents?: true

Size: 892 Bytes

Versions: 15

Compression:

Stored size: 892 Bytes

Contents

module InventoryUpload
  module ReportActions
    extend ActiveSupport::Concern

    class ReportMissingError < Foreman::Exception
      MESSAGE = N_("The report file %{filename} doesn't exist")

      def initialize(**params)
        super(self.class::MESSAGE % params, params)
      end
    end

    def start_report_generation(organization_id, disconnected)
      ForemanTasks.async_task(ForemanInventoryUpload::Async::GenerateReportJob, ForemanInventoryUpload.generated_reports_folder, organization_id, disconnected)
    end

    def report_file(organization_id)
      filename = ForemanInventoryUpload.facts_archive_name(organization_id)
      files = Dir["{#{ForemanInventoryUpload.uploads_file_path(filename)},#{ForemanInventoryUpload.done_file_path(filename)}}"]

      raise ReportMissingError.new(filename: filename) if files.empty?

      [filename, files.first]
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
foreman_rh_cloud-11.0.3 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-9.0.59 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-11.0.2 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-11.0.1 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-11.0.0 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-9.0.58 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-10.0.2 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-9.0.57 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-10.0.1 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-9.0.56 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-9.0.55 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-9.0.54 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-9.0.53 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-9.0.52 app/controllers/concerns/inventory_upload/report_actions.rb
foreman_rh_cloud-8.0.52 app/controllers/concerns/inventory_upload/report_actions.rb