Project

General

Profile

Refactor #20477

remove usages of /subscriptions for candlepin interaction

Added by Justin Sherrill about 2 years ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Subscriptions
Target version:
Branch:
Difficulty:
medium
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
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/

History

#1 Updated by Justin Sherrill about 2 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)

#2 Updated by Eric Helms about 2 years ago

  • Legacy Backlogs Release (now unused) set to 114

Also available in: Atom PDF