Sha256: 1bd273ebb113f75fecb69e10ff3a107d374e0a778ebf61a1e89ff371d9ed3f85
Contents?: true
Size: 1.3 KB
Versions: 51
Compression:
Stored size: 1.3 KB
Contents
require_dependency "redhat_access/application_controller" require_dependency "redhat_access/strata/client" require_dependency "redhat_access/sos_reports/generator" module RedhatAccess module Api class AttachmentsController < RedhatAccess::Api::ApiController wrap_parameters :attach_payload, format: :json def index render :text => "SOS Report?checked=true", :layout => false end def create data = params[:attach_payload] begin case_number = data[:caseNum] sos_file = RedhatAccess::SosReports::Generator.create_report case_number strata = RedhatAccess::Strata::Client.new(data[:authToken]) strata.api.attachment_broker.add(case_number, false, sos_file, "Attachment for case #{case_number}") render :nothing => true, :status => 201 rescue => e logger.error e.backtrace #logger.error "Failed to import facts for Host::Discovered: #{e}" render :text => "Error attaching sos file " + e.message, :layout => false , :status => 500 end end def api_version 'v1' end end end end
Version data entries
51 entries across 51 versions & 1 rubygems