Bug 1671531 - Expose route for system purpose compliance
Summary: Expose route for system purpose compliance
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API - Content
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Released
Assignee: Jonathon Turel
QA Contact: Mirek Zalewski
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-31 20:25 UTC by Jonathon Turel
Modified: 2019-10-07 17:19 UTC (History)
3 users (show)

Fixed In Version: tfm-rubygem-katello-3.10.0.24-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:40:00 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:40:11 UTC
Foreman Issue Tracker 25955 None None None 2019-01-31 20:25:27 UTC

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@redhat.com

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 Zalewski 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 Zalewski 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


Note You need to log in before you can comment on or make changes to this bug.