Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1671531

Summary: Expose route for system purpose compliance
Product: Red Hat Satellite Reporter: Jonathon Turel <jturel>
Component: API - ContentAssignee: Jonathon Turel <jturel>
Status: CLOSED ERRATA QA Contact: Mirek Długosz <mzalewsk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: ehelms, mmccune, mzalewsk
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.10.0.24-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:40:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathon Turel 2019-01-31 20:25:27 UTC
This is needed by subscription-manager which currently will only show "Unknown":

<pre>
[root@rhel vagrant]# subscription-manager status                                                                                                

+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Invalid

Red Hat Enterprise Linux:
- Not supported by a valid subscription.

System Purpose Status: Unknown
</pre>

Comment 1 Jonathon Turel 2019-01-31 20:25:28 UTC
Created from redmine issue https://projects.theforeman.org/issues/25955

Comment 2 Jonathon Turel 2019-01-31 20:25:30 UTC
Upstream bug assigned to jturel

Comment 4 Bryan Kearney 2019-02-04 23:08:05 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25955 has been resolved.

Comment 6 Mirek Długosz 2019-03-06 16:38:22 UTC
`/rhsm/consumers/<id>/purpose_compliance` API endpoint is exposed by Satellite.

Excerpt of sample output for GET request on this endpoint:

#v+
{
    "compliant": false,
    "compliantAddOns": {},
    "compliantRole": {},
    "compliantSLA": {},
    "compliantUsage": {},
    "date": "2019-03-06T15:55:10+0000",
    "nonCompliantAddOns": [],
    "nonCompliantRole": "Red Hat Enterprise Linux Server",
    "nonCompliantSLA": "Premium",
    "nonCompliantUsage": "Development/Test"
    ...
}
#v-

nonCompliant* values are consistent with values I have put in web UI.

Output of subscription-manager status on content host:

#v+
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

System Purpose Status: invalid
#v-

(Note that "invalid" is correct value; "Unknown" would signify that there is problem with obtaining system purpose data.)

Looking at server logs, it seems that subscription-manager doesn't hit that endpoint itself. It might be caused by older version of subscription-manager on content host in test environment (1.23.7). System purpose values are also exposed in /rhsm/consumers/<id> - these values are consistent with what I have put in web UI.


Version:
Satellite 6.5 snap 18
tfm-rubygem-katello-3.10.0.24-1.el7sat.noarch
foreman-1.20.1.10-1.el7sat.noarch
pulp-server-2.18.0-0.1.rc.el7sat.noarch
satellite-6.5.0-6.beta.el7sat.noarch
subscription-manager-1.23.7-1.el8.x86_64 (on content host)

Comment 7 Jonathon Turel 2019-03-06 16:42:59 UTC
Hey Mirek,

I think you'll want to try updating subscription-manager on your client just to make sure you can see it hit that endpoint as that's the crux of this change. My client has 1.23.8-32

Comment 8 Mirek Długosz 2019-03-06 19:19:47 UTC
Jonathon,

Re-checked on subscription-manager 1.23.8-34.

Excerpt from Satellite server logs (/rhsm/consumers/<id>/purpose_compliance endpoint is among these requested):

2019-03-06T19:15:41 [I|app|] Started PUT "/rhsm/consumers/531a8abc-775e-4394-a640-60e9b7a34eee" for 192.168.121.60 at 2019-03-06 19:15:41 +0000
2019-03-06T19:15:41 [I|app|ae43697c] Processing by Katello::Api::Rhsm::CandlepinProxiesController#facts as JSON
2019-03-06T19:15:41 [I|app|ae43697c]   Parameters: {"installedProducts"=>[{"productId"=>"486", "productName"=>"Red Hat Enterprise Linux for x86_64 Beta", "version"=>"8.0 Beta", "arch"=>"x86_64"}], "contentTags"=>["rhel-8-beta-x86_64", "rhel-8"], "id"=>"531a8abc-775e-4394-a640-60e9b7a34eee"}
2019-03-06T19:15:41 [I|app|ae43697c] Current user set to 531a8abc-775e-4394-a640-60e9b7a34eee (regular)
2019-03-06T19:15:41 [I|app|ae43697c] Completed 200 OK in 170ms (Views: 0.5ms | ActiveRecord: 37.5ms)
2019-03-06T19:15:41 [I|app|] Started GET "/rhsm/consumers/531a8abc-775e-4394-a640-60e9b7a34eee/compliance" for 192.168.121.60 at 2019-03-06 19:15:41 +0000
2019-03-06T19:15:41 [I|app|bfcff636] Processing by Katello::Api::Rhsm::CandlepinProxiesController#get as JSON
2019-03-06T19:15:41 [I|app|bfcff636]   Parameters: {"id"=>"531a8abc-775e-4394-a640-60e9b7a34eee"}
2019-03-06T19:15:41 [I|app|bfcff636] Current user set to 531a8abc-775e-4394-a640-60e9b7a34eee (regular)
2019-03-06T19:15:42 [I|app|bfcff636] Completed 200 OK in 72ms (Views: 0.1ms | ActiveRecord: 4.7ms)
2019-03-06T19:15:42 [I|app|] Started GET "/rhsm/consumers/531a8abc-775e-4394-a640-60e9b7a34eee/owner" for 192.168.121.60 at 2019-03-06 19:15:42 +0000
2019-03-06T19:15:42 [I|app|0e9520e6] Processing by Katello::Api::Rhsm::CandlepinProxiesController#get as JSON
2019-03-06T19:15:42 [I|app|0e9520e6]   Parameters: {"id"=>"531a8abc-775e-4394-a640-60e9b7a34eee"}
2019-03-06T19:15:42 [I|app|0e9520e6] Current user set to 531a8abc-775e-4394-a640-60e9b7a34eee (regular)
2019-03-06T19:15:42 [I|app|0e9520e6] Completed 200 OK in 29ms (Views: 0.1ms | ActiveRecord: 2.9ms)
2019-03-06T19:15:42 [I|app|] Started GET "/rhsm/status" for 192.168.121.60 at 2019-03-06 19:15:42 +0000
2019-03-06T19:15:42 [I|app|0325fb3f] Processing by Katello::Api::Rhsm::CandlepinProxiesController#server_status as JSON
2019-03-06T19:15:42 [I|app|0325fb3f] Completed 200 OK in 16ms (Views: 0.3ms | ActiveRecord: 2.4ms)
2019-03-06T19:15:42 [I|app|] Started GET "/rhsm/consumers/531a8abc-775e-4394-a640-60e9b7a34eee/purpose_compliance" for 192.168.121.60 at 2019-03-06 19:15:42 +0000
2019-03-06T19:15:42 [I|app|7cf765ff] Processing by Katello::Api::Rhsm::CandlepinProxiesController#get as JSON
2019-03-06T19:15:42 [I|app|7cf765ff]   Parameters: {"id"=>"531a8abc-775e-4394-a640-60e9b7a34eee"}
2019-03-06T19:15:42 [I|app|7cf765ff] Current user set to 531a8abc-775e-4394-a640-60e9b7a34eee (regular)
2019-03-06T19:15:42 [I|app|7cf765ff] Completed 200 OK in 58ms (Views: 0.2ms | ActiveRecord: 3.5ms)

On content host side:
#v+
# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

System Purpose Status: Mismatched
#v-

Comment 9 Jonathon Turel 2019-03-06 19:42:08 UTC
That's perfect - now we are doubly verified. Thanks Mirek!

Comment 12 errata-xmlrpc 2019-05-14 12:40:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222