Project

General

Profile

Actions

Refactor #20477

open

remove usages of /subscriptions for candlepin interaction

Added by Justin Sherrill over 6 years ago. Updated over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Subscriptions
Target version:
Branch:
Difficulty:
medium
Triaged:
Fixed in Releases:
Found in Releases:

Description

/subscriptions is being removed from candlepin at some point in the future. We need to remove our usages of it in favor of /owners/:ID/pools/

Actions #1

Updated by Justin Sherrill over 6 years ago

  • Difficulty changed from easy to medium
      def import_data
        subscription_attributes = {}
        subscription_json = self.backend_data

        subscription_json["product"]["attributes"].map { |attr| subscription_attributes[attr["name"].to_sym] = attr["value"] }

        subscription_attributes[:name] = subscription_json["product"]["name"]
        subscription_attributes[:product_id] = subscription_json["product"]["id"]
        subscription_attributes[:instance_multiplier] = subscription_json["product"]["multiplier"]
        subscription_attributes[:stacking_id] = subscription_json["stackId"]
        organization = Organization.find_by(:label => subscription_json["owner"]["key"]) if subscription_json["owner"]
        subscription_attributes[:organization_id] = organization.id if organization

        exceptions = subscription_attributes.keys.map(&:to_sym) - self.attribute_names.map(&:to_sym)
        self.update_attributes!(subscription_attributes.except!(*exceptions))
        self.create_product_associations
      end

when fetching subs, we will need to use the products and possibly pools api to get the information we need. We can differentiate between a marketing and engineering product id by the fact that a marketing id is alpha-numeric and an engineering id is numerical (yes this is hacky)

Actions #2

Updated by Eric Helms over 6 years ago

  • translation missing: en.field_release set to 114
Actions

Also available in: Atom PDF