Syspurpose role is showing empty in the subscription page and rest api even it has a role
Description of problem:
Go to Web UI -> Content -> Subscriptions -> pick a subscription with role, "Red Hat Enterprise Linux Server with Smart Management, Premium (Physical or Virtual Nodes)" is a good candidate -> Details tab
Under "System Purpose" section, role is empty.
You can also reproduce via rest api:
curl -v -k -u "username:password" https://satellite.example.com/katello/api/organizations/1/subscriptions/<subscription id> | python -m json.tool
"roles": null, <================== Role is null
It is because of the "s" word (plural). Candlepin calls it roles but Katello calls it role.
See the below lines in "glue/candlepin/pool.rb" for more details:
lazy_accessor :pool_derived, :owner, :source_pool_id, :virt_limit, :arch, :description, :product_family,
:variant, :suggested_quantity, :support_type, :product_id, :type, :upstream_entitlement_id, :roles, :usage, :addons,
:initializer => :pool_facts