Refactor #20477
open
remove usages of /subscriptions for candlepin interaction
Added by Justin Sherrill almost 8 years ago.
Updated 8 months ago.
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/
- 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)
- Translation missing: en.field_release set to 114
- Target version deleted (
Katello Backlog)
Also available in: Atom
PDF