Bug 1335371

Summary: Despite an "Insufficient" subscription status, the GUI is blocked from auto-subscribing by "No need to update subscriptions" message.
Product: Red Hat Enterprise Linux 7 Reporter: qianzhan
Component: subscription-managerAssignee: William Poteat <wpoteat>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: csnyder, jsefler, ldai, qianzhan, redakkan, skallesh, vrjain, wpoteat
Target Milestone: pre-dev-freezeKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 20:28:58 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:
Attachments:
Description Flags
notice_when_trying_to_auto-attach_with_an_already_attached_system_in_GUI.png
none
When_status_insufficient_gui_shows_no_need_autoattach.png
none
register_and_auto-attach.png
none
auto-attach_in_GUI_when_Insufficient_subscription_status.png none

Description qianzhan 2016-05-12 05:56:01 UTC
Description of problem:
There is no notice when auto-attach again on a already auto-attached system

Version-Release number of selected component (if applicable):
Satellite-6.2.0-RHEL-6-20160506.0

How reproducible:
always

Steps to Reproduce:
1. Register rhel6.8 against Satellite-6.2.0-RHEL-6-20160506.0.
[root@dhcp-128-71 ~]# subscription-manager register
Registering to: satellite6.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: 46b1eb43-9b64-4714-8e7e-0e83546913d1 

2. Auto attach the system:
[root@dhcp-128-71 ~]# subscription-manager attach


Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

3. Auto attach again after step 2:
[root@dhcp-128-71 ~]# subscription-manager attach


Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@dhcp-128-71 ~]# subscription-manager attach


Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

4. Check the consumed subscription:
[root@dhcp-128-71 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Red Hat Enterprise Linux Server for PRIMEQUEST, Premium (2
                     sockets) (L3 Only)
Provides:            Red Hat Enterprise Linux High Performance Networking (for
                     RHEL Server) - Extended Update Support
                     Red Hat Enterprise Linux Server - Extended Update Support
                     Red Hat Enterprise Linux Server
                     Red Hat Enterprise Linux Atomic Host
                     Red Hat EUCJP Support (for RHEL Server) - Extended Update
                     Support
                     Red Hat Enterprise Linux Resilient Storage (for RHEL
                     Server) - Extended Update Support
                     Red Hat Beta
                     Red Hat Software Collections (for RHEL Server)
                     Red Hat Enterprise Linux High Availability (for RHEL
                     Server) - Extended Update Support
                     Red Hat Enterprise Linux Atomic Host Beta
                     Red Hat Developer Toolset (for RHEL Server)
                     Red Hat Enterprise Linux Scalable File System (for RHEL
                     Server) - Extended Update Support
                     Red Hat Software Collections Beta (for RHEL Server)
                     Red Hat Enterprise Linux Load Balancer (for RHEL Server) -
                     Extended Update Support
                     Red Hat Container Images
                     Red Hat Container Images Beta
                     Red Hat S-JIS Support (for RHEL Server) - Extended Update
                     Support
SKU:                 RH00204
Contract:            10752431
Account:             5584289
Serial:              1224066339873681472
Pool ID:             8ac9835e549e5fbe01549e70feba02a2
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       Premium
Service Type:        L3
Status Details:      Guest has not been reported on any host and is using a
                     temporary unmapped guest subscription.
Subscription Type:   Standard (Temporary)
Starts:              02/29/2016
Ends:                05/13/2016
System Type:         Virtual

[root@dhcp-128-71 ~]# 




Actual results:
As step 3.

Expected results:
There should be a notice to inform the system is auto-attached already. No need to auto attach again.

Additional info:

Comment 1 Barnaby Court 2016-05-13 17:25:11 UTC
The auto-attach updates the facts from the systems. We do not know until it has been processed that no new entitlements were added. An auto-attach was performed each time as requested from the command line. 

Is the request that if auto-attach is run, and no new entitlements were added, subscription-manager should print a message indicating that no new entitlements were added?

Comment 2 qianzhan 2016-05-16 03:34:57 UTC
Hi Barnaby

The attachment, 'notice_when_trying_to_auto-attach_with_an_already_attached_system_in_GUI.png', is the reasonable behavior in GUI. If the installed products are covered by valid entitlements, there is no need to attaching any subscriptions.  And the logic should keep consistency with CLI and GUI.

Comment 3 qianzhan 2016-05-16 03:35:30 UTC
Created attachment 1157788 [details]
notice_when_trying_to_auto-attach_with_an_already_attached_system_in_GUI.png

Comment 4 Barnaby Court 2016-05-23 15:23:06 UTC
Moving to sub-man as that is where this bug will be fixed.

Comment 6 John Sefler 2016-06-02 17:12:43 UTC
This is not a bug because....

1. The functionality in comment 1 and comment 2 was already implemented by bug 864207 for *BOTH* the CLI and GUI.

2. If the system was truly compliant/valid in comment 0, then the CLI output would look like this (notice the "No need to update subscriptions" message)...

[root@jsefler-rhel7 ~]# subscription-manager attach

All installed products are covered by valid entitlements. No need to update subscriptions at this time.

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

3. The reason the bug reporter is not seeing the "No need to update subscriptions" message, is probably because the overall system status is "Insufficient".  I'll bet that if the bug reporter ran "subscription-manager status", then the report might look like this...

[root@jsefler-rhel7 product]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Insufficient

Red Hat Enterprise Linux, Standard (up to 2 sockets)(up to 4 Guests):
- Guest has not been reported on any host and is using a temporary unmapped guest subscription.


NEEDINFO: please run "subscription-manager status" to see if your overall system status is "Valid".  If it is valid, then your duplicate calls to "subscription-manager attach" will display the "No need..." message that you are expecting.  If your overall system status is NOT "Valid", then the auto-attach function will run again as you saw in comment 0.

Comment 7 qianzhan 2016-06-03 07:23:56 UTC
Hi John,

I tried again on RHEL7.2 against satellite6.2-20160601.0:

1)

[root@dhcp-128-26 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.0.0.41-Unknown
subscription management rules: 5.15.2
subscription-manager: 1.15.9-15.el7
python-rhsm: 1.15.4-5.el7

2)

[root@dhcp-128-26 ~]# subscription-manager identity
system identity: cacbf4ad-0dcc-4d99-afee-f3caf9af5c1c
name: dhcp-128-26.nay.redhat.com
org name: Default Organization
org ID: Default_Organization
environment name: Library
[root@dhcp-128-26 ~]# subscription-manager attach


Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@dhcp-128-26 ~]# subscription-manager attach


Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@dhcp-128-26 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Insufficient

Red Hat Enterprise Linux Server for PRIMEQUEST, Premium (2 sockets) (L3 Only):
- Guest has not been reported on any host and is using a temporary unmapped
  guest subscription.

3) Open subscription-manager-gui, click 'Auto-attach' button. A window shows 'No need to attach subscriptions at this time'. Please see attachment 'When_status_infficient_gui_shows_no_need_autoattach.png'.


Step 2) meets logic in comment 6, but step 3) does not. How do you think of step 3), John? Need a new bug?

Comment 8 qianzhan 2016-06-03 07:25:45 UTC
Created attachment 1164359 [details]
When_status_insufficient_gui_shows_no_need_autoattach.png

Comment 9 John Sefler 2016-06-03 12:55:12 UTC
Based on the behavior in comment 7, I would argue that subscription-manager-gui is failing to attempt an auto-subscribe for a system whose status is "Insufficient".  Ironically, the CLI is behaving correctly and the GUI is deficient.

Let's keep this bug open for the devel team to review subscription-manager-gui, but I will change the summary title.

Comment 10 William Poteat 2016-06-29 00:26:51 UTC
PR at https://github.com/candlepin/subscription-manager/pull/1437

Comment 11 Chris Snyder 2016-07-08 21:32:25 UTC
master commit:

c9d6a49ad8d373d329996c053ecc9b09a16ebac3

Comment 13 qianzhan 2016-07-14 02:59:56 UTC
Verified.

1. Install RHEL7.2 and upgrade subscription-manager and python-rhsm.
subscription-manager: 1.17.9-1.el7
python-rhsm: 1.17.5-1.el7

2. Register RHEL7.2 to Satellite-6.2.0-RHEL-7-20160713.0, and auto-attach. The status is Insufficient.

Please see attachment 'register_and_auto-attach.png'

3. Open GUI, and click Auto-attach button. The GUI is trying to find a subscription to auto-attach.

Please see attachment 'auto-attach_in_GUI_when_Insufficient_subscription_status.png'

Comment 14 qianzhan 2016-07-14 03:00:40 UTC
Created attachment 1179576 [details]
register_and_auto-attach.png

Comment 15 qianzhan 2016-07-14 03:01:17 UTC
Created attachment 1179577 [details]
auto-attach_in_GUI_when_Insufficient_subscription_status.png

Comment 17 errata-xmlrpc 2016-11-03 20:28:58 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://rhn.redhat.com/errata/RHSA-2016-2592.html