Sha256: d9ff92fbdd1e46e407e39d5cc8470d9cfa3856a39e4ccf58973d0564c68c9d69

Contents?: true

Size: 932 Bytes

Versions: 9

Compression:

Stored size: 932 Bytes

Contents

module ForemanInventoryUpload
  class UploadsController < ::ApplicationController
    def last
      label = ForemanInventoryUpload::Async::UploadReportJob.output_label(params[:organization_id])
      output = ForemanInventoryUpload::Async::ProgressOutput.get(label)&.full_output

      render json: {
        output: output,
      }, status: :ok
    end

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

      return send_file files.first, disposition: 'attachment', filename: filename unless files.empty?
      raise ::Foreman::Exception.new("The report file doesn't exist")
    end

    def enable_cloud_connector
      cloud_connector = ForemanRhCloud::CloudConnector.new
      render json: cloud_connector.install.to_json
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.22 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-4.0.22 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-4.0.21.1 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-3.0.21.1 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-3.0.21 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-3.0.20 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-3.0.19 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-3.0.18.1 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-3.0.18 app/controllers/foreman_inventory_upload/uploads_controller.rb