Sha256: a2ee8e2a37cf2d62be42084e16c026e8c1401db76711be186d35f0fdaa7c32b2

Contents?: true

Size: 697 Bytes

Versions: 81

Compression:

Stored size: 697 Bytes

Contents

module InsightsCloud
  module CandlepinCache
    extend ActiveSupport::Concern

    def upstream_owner(org)
      # We use a cache because owner_details is a call to Candlepin
      Rails.cache.fetch("rh_cloud_upstream_owner_#{org.id}", expires_in: 1.minute) do
        org.owner_details['upstreamConsumer']
      end
    end

    def cp_owner_id(org)
      owner = upstream_owner(org)
      owner['uuid'] if owner
    end

    def candlepin_id_cert(org)
      owner = upstream_owner(org)
      return unless owner
      id_cert = {
        cert: owner.dig('idCert', 'cert'),
        key: owner.dig('idCert', 'key'),
      }
      return unless id_cert.values.all?
      id_cert
    end
  end
end

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
foreman_rh_cloud-9.0.59 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-11.0.2 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-11.0.1 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-11.0.0 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-9.0.58 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-10.0.2 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-9.0.57 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-10.0.1 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-9.0.56 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-9.0.55 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-9.0.54 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-9.0.53 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-9.0.52 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-8.0.52 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-9.0.51 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-8.0.51 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-7.0.48 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-7.0.47 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-8.0.50 app/controllers/concerns/insights_cloud/candlepin_cache.rb
foreman_rh_cloud-8.0.49 app/controllers/concerns/insights_cloud/candlepin_cache.rb