Sha256: 75f10c70baefdf9d1ef3f4eba91ad5cf262d29413683e30828cf15984ffa9780

Contents?: true

Size: 892 Bytes

Versions: 8

Compression:

Stored size: 892 Bytes

Contents

module Katello
  module Resources
    module Candlepin
      class UpstreamJob < UpstreamCandlepinResource
        class << self
          NOT_FINISHED_STATES = %w(CREATED WAITING PENDING RUNNING).freeze unless defined? NOT_FINISHED_STATES
          API_URL = 'https://subscription.rhsm.redhat.com/subscription'.freeze

          def not_finished?(job)
            NOT_FINISHED_STATES.include?(job[:state])
          end

          def get(id, upstream)
            url = ENV['REDHAT_RHSM_API_URL'] || API_URL
            response = Resources::Candlepin::UpstreamConsumer.start_upstream_export("#{url}#{path(id)}", upstream['idCert']['cert'],
              upstream['idCert']['key'], nil)
            job = JSON.parse(response)
            job.with_indifferent_access
          end

          def path(id = nil)
            "/jobs/#{id}"
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
katello-4.15.0.rc2 app/lib/katello/resources/candlepin/upstream_job.rb
katello-4.15.0.rc1 app/lib/katello/resources/candlepin/upstream_job.rb
katello-4.14.1 app/lib/katello/resources/candlepin/upstream_job.rb
katello-4.14.0 app/lib/katello/resources/candlepin/upstream_job.rb
katello-4.14.0.rc3 app/lib/katello/resources/candlepin/upstream_job.rb
katello-4.14.0.rc2 app/lib/katello/resources/candlepin/upstream_job.rb
katello-4.14.0.rc1.1 app/lib/katello/resources/candlepin/upstream_job.rb
katello-4.14.0.rc1 app/lib/katello/resources/candlepin/upstream_job.rb