Sha256: 730c241295f0dd67eb70a5705bc19453a738d5d71c51b4d8e6eb6325de03d8fb

Contents?: true

Size: 933 Bytes

Versions: 5

Compression:

Stored size: 933 Bytes

Contents

module ForemanInventoryUpload
  class UploadsController < ::ApplicationController
    include InventoryUpload::ReportActions

    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, file = report_file(params[:organization_id])

      send_file file, disposition: 'attachment', filename: filename
    end

    def enable_cloud_connector
      Organization.unscoped.each do |org|
        presence = ForemanRhCloud::CloudPresence.new(org, logger)
        presence.announce_to_sources
      rescue StandardError => ex
        logger.warn(ex)
      end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_rh_cloud-5.0.37 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-5.0.36 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-5.0.35 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-5.0.34 app/controllers/foreman_inventory_upload/uploads_controller.rb
foreman_rh_cloud-5.0.33 app/controllers/foreman_inventory_upload/uploads_controller.rb