Sha256: 86ff5203bfa68857030293c48f81f6e4692d52c0d464d6081aa8870b7590d2b6
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
require 'tempfile' module ForemanInventoryUpload module Async class UploadReportJob < ShellProcess def self.output_label(label) "upload_for_#{label}" end def perform(filename, organization_id) @filename = filename @organization = Organization.find(organization_id) Tempfile.create([@organization.name, '.pem']) do |cer_file| cer_file.write(rh_credentials[:cert]) cer_file.write(rh_credentials[:key]) cer_file.flush @cer_path = cer_file.path super(UploadReportJob.output_label(organization_id)) end end def command ['/bin/bash', File.join(File.dirname(@filename), ForemanInventoryUpload.upload_script_file)] end def env env_vars = super.merge( 'FILES' => @filename, 'CER_PATH' => @cer_path ) if http_proxy_string env_vars['http_proxy'] = http_proxy_string env_vars['https_proxy'] = http_proxy_string end env_vars end def http_proxy_string @http_proxy_string ||= HttpProxy.default_global_content_proxy&.full_url end def rh_credentials @rh_credentials ||= begin candlepin_id_certificate = @organization.owner_details['upstreamConsumer']['idCert'] { cert: candlepin_id_certificate['cert'], key: candlepin_id_certificate['key'], } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_rh_cloud-2.0.9 | lib/foreman_inventory_upload/async/upload_report_job.rb |