Bug 1594733

Summary: Method GetStatus from D-Bus interface com.redhat.RHSM1.Entitlement can return wrong status
Product: Red Hat Enterprise Linux 7 Reporter: Jiri Hnidek <jhnidek>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: medium    
Version: 7.5CC: csnyder, jsefler, jstavel, khowell, skallesh
Target Milestone: rcKeywords: EasyFix, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 10:36:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiri Hnidek 2018-06-25 09:59:15 UTC
Description of problem:
When method GetStatus from interface com.redhat.RHSM1.Entitlement is called with option: "on_date" and the system will not have any valid subscription on this date, then GetStatus still returns "Current" status. CLI tool subscription-manager works as expected.

Version-Release number of selected component (if applicable):
[root@localhost ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.3.8-1
subscription management rules: 5.26
subscription-manager: 1.20.11-1.el7_5

How reproducible:
Always

Steps to Reproduce:
1. Make sure that there is some certificate in /etc/pki/product-default

2. Register the system to candlepin server

[root@localhost ~]# subscription-manager register --username admin --password admin --org admin

3. Attach to default product

[root@localhost ~]# subscription-manager attach --auto

4. Make sure that status is current:

[root@localhost ~]# subscription-manager register status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

5. Get information about consumed subscriptions:

[root@localhost ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS Instance Based one socket
Provides:            Awesome OS Instance Server Bits
SKU:                 awesomeos-onesocketib
Contract:            0
Account:             12331131231
Serial:              984540824533750213
Pool ID:             Not Available
Provides Management: Yes
Active:              True
Quantity Used:       2
Service Level:       Standard
Service Type:        L1-L3
Status Details:      Subscription is current
Subscription Type:   
Starts:              25.6.2018
Ends:                25.6.2019   <============= Subscription will not be valid after this date
System Type:         Physical

6. Make sure subscription-manager works as expected:

[root@localhost ~]# subscription-manager status --ondate=2028-06-06
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Invalid

7. Try to get same result using D-Bus API:

[root@localhost ~]# busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Entitlement com.redhat.RHSM1.Entitlement GetStatus ss "2028-06-06" ""

Actual results:
s "{\"status\": \"Current\", \"reasons\": {}, \"valid\": true}"

Expected results:
s "{\"status\": \"Invalid\", \"reasons\": {\"Awesome OS Instance Server Bits: - Not supported by a valid subscription.\"}, \"valid\": false}"

Additional info:
When rhsm.service is restarted, then the D-Bus interface still returns wrong result.

Comment 3 Shwetha Kallesh 2018-07-31 09:26:12 UTC
[root@localhost ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.5.5-1
subscription management rules: 5.27
subscription-manager: 1.21.5-7.el7


[root@localhost ~]# subscription-manager attach --pool 8acce25664db170f0164db1baff3044c
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)
[root@localhost ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS Instance Based (Standard Support)
Provides:            Awesome OS Instance Server Bits
SKU:                 awesomeos-instancebased
Contract:            1
Account:             12331131231
Serial:              4642267440434512120
Pool ID:             8acce25664db170f0164db1baff3044c
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       Standard
Service Type:        L1-L3
Status Details:      Subscription is current
Subscription Type:   Instance Based
Starts:              07/27/2018
Ends:                07/27/2019
System Type:         Physical

[root@localhost ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

[root@localhost ~]#  busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Entitlement com.redhat.RHSM1.Entitlement GetStatus ss "" ""
s "{\"status\": \"Current\", \"reasons\": {}, \"valid\": true}"


[root@localhost ~]# subscription-manager status --ondate=2028-06-06
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Invalid

Awesome OS Instance Server Bits:
- Not supported by a valid subscription.

[root@localhost ~]#  busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Entitlement com.redhat.RHSM1.Entitlement GetStatus ss "2028-06-06" ""
s "{\"status\": \"Invalid\", \"reasons\": {\"Awesome OS Instance Server Bits\": [\"Not supported by a valid subscription.\"]}, \"valid\": false}"

Comment 5 errata-xmlrpc 2018-10-30 10:36:12 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/RHBA-2018:3153