Bug 983250 - subscription-manager-gui uses a hard-coded WARNING_DAYS = 6 * 7; warning_period from entitlement is ignored
subscription-manager-gui uses a hard-coded WARNING_DAYS = 6 * 7; warning_per...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: subscription-manager (Show other bugs)
5.10
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Carter Kozak
IDM QE LIST
:
Depends On:
Blocks: rhsm-rhel510
  Show dependency treegraph
 
Reported: 2013-07-10 15:56 EDT by John Sefler
Modified: 2014-09-14 20:08 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
No description necessary
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-30 19:12:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
warning icon (201.69 KB, image/png)
2013-08-07 10:49 EDT, Sharath Dwaral
no flags Details

  None (edit)
Description John Sefler 2013-07-10 15:56:09 EDT
Description of problem:
One of the attributes of a subscription product is warning_period.  The intent of this attribute is to warn the consumer that the entitlement is about to expire within this number of days before the end date.  Within the subscription-manager-gui, the subscription about to expire will turn yellow on the "My Subscriptions" tab.  Unfortunately the subscription-manager-gui appears to be using a hard-coded warning period of 42 days instaed of using the value from the entitlement.

The hard-coded values are found here...

[root@jsefler-5 ~]# grep WARNING_DAYS /usr/share/rhsm/subscription_manager/gui/*.py
/usr/share/rhsm/subscription_manager/gui/mysubstab.py:WARNING_DAYS = 6 * 7   # 6 weeks * 7 days / week
/usr/share/rhsm/subscription_manager/gui/mysubstab.py:        if date_range.end() - timedelta(days=WARNING_DAYS) < now:
/usr/share/rhsm/subscription_manager/gui/widgets.py:WARNING_DAYS = 6 * 7   # 6 weeks * 7 days / week
/usr/share/rhsm/subscription_manager/gui/widgets.py:        if end - datetime.timedelta(days=WARNING_DAYS) < now:

To see what the warning period should be for each consumed subscription, use the rct cat-cert tool like this...

[root@jsefler-5 ~]# for f in `ls /etc/pki/entitlement/*.pem | grep -v key`; do rct cat-cert --no-content $f | egrep "Name|Warning Period"; done;
	Name: Awesome OS Server Basic (data center)
	Warning Period: 30
	Name: Awesome OS Server Bits
	Name: Awesome OS Server Basic (dc-virt)
	Warning Period: 0


Version-Release number of selected component (if applicable):
[root@jsefler-5 ~]# rpm -q subscription-manager-gui
subscription-manager-gui-1.8.11-1.el5


Additional info:
Comment 1 RHEL Product and Program Management 2013-07-10 16:17:37 EDT
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.
Comment 2 Carter Kozak 2013-07-12 16:18:12 EDT
commit eacaa452361e1f716390ad3fd90cf65e9c3f3c76
Author: ckozak <ckozak@redhat.com>
Date:   Wed Jul 10 11:24:26 2013 -0400

    983250: 983281: certs check warning period
Comment 5 Sharath Dwaral 2013-08-07 10:49:20 EDT
Created attachment 783957 [details]
warning icon

Version:

# rpm -qa | egrep "subscription-manager|python-rhsm"
subscription-manager-gui-1.8.18-1.el5
subscription-manager-migration-data-1.11.3.2-1.git.0.14f9d59.el5
python-rhsm-1.8.16-1.el5
subscription-manager-migration-1.8.18-1.el5
subscription-manager-1.8.18-1.el5
subscription-manager-firstboot-1.8.18-1.el5
python-rhsm-debuginfo-1.8.16-1.el5
subscription-manager-debuginfo-1.8.18-1.el5

Verification:

# grep WARNING_DAYS /usr/share/rhsm/subscription_manager/gui/*.py
/usr/share/rhsm/subscription_manager/gui/widgets.py:WARNING_DAYS = 6 * 7   # 6 weeks * 7 days / week

There is still a hard coded value for WARNING_DAYS but it is not referenced anywhere. 

# for f in `ls /etc/pki/entitlement/*.pem | grep -v key`; do rct cat-cert --no-content $f | egrep "Name|Warning Period"; done;
        Name: Awesome OS Server Bits
	Name: Awesome OS Server Basic (multi-entitlement)
	Warning Period: 30

# rct cat-cert /etc/pki/entitlement/8294565152797454133.pem | grep -i "certificate:" -A7
Certificate:
	Path: /etc/pki/entitlement/8294565152797454133.pem
	Version: 3.2
	Serial: 8294565152797454133
	Start Date: 2013-07-30 00:00:00+00:00
	End Date: 2014-07-30 00:00:00+00:00
	Pool ID: 8a8d01e0402f9e3b01402f9f6040049a

Advancing date to within warning period

# date -s "30 JUN 2014 18:00:00"

Warning icon is displayed in "My Subscription" tab (See attachment)
Comment 6 Sharath Dwaral 2013-08-07 10:49:51 EDT
Moving to VERIFIED
Comment 8 errata-xmlrpc 2013-09-30 19:12:57 EDT
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.

http://rhn.redhat.com/errata/RHBA-2013-1332.html

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