Bug 1319678 - subscription-manager remove --serial should tell the consumed subscription was already deleted.
Summary: subscription-manager remove --serial should tell the consumed subscription w...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.8
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: rc
: ---
Assignee: William Poteat
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-21 10:24 UTC by xingge
Modified: 2018-03-14 22:02 UTC (History)
7 users (show)

Fixed In Version: subscription-manager-1.18.1-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-14 22:02:32 UTC
Target Upstream Version:


Attachments (Terms of Use)
the log for rhsm (1.21 MB, text/plain)
2016-03-21 10:24 UTC, xingge
no flags Details
rhsm log for non-exist serial (13.43 KB, text/plain)
2016-04-08 07:10 UTC, qianzhan
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 1416 0 None closed 1319678: Alter the return message for removing entitlements at server 2020-10-23 04:54:01 UTC

Description xingge 2016-03-21 10:24:51 UTC
Created attachment 1138528 [details]
the log for rhsm

Description of problem:
subscription-manager remove --serial should tell the  consumed subscription was already deleted.

Version-Release number of selected component (if applicable):
[root@localhost ~]# rpm -qa |grep subscr
subscription-manager-1.16.8-5.el6.x86_64
subscription-manager-gui-1.16.8-5.el6.x86_64
subscription-manager-firstboot-1.16.8-5.el6.x86_64
python-rhsm-1.16.6-1.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1.attach a subscription
[root@localhost ~]# subscription-manager attach --pool=8a99f986515dc0cd015166cfe9c22b20
Successfully attached a subscription for: Red Hat Enterprise Linux Server, Premium (8 sockets) (Up to 4 guests)
[root@localhost ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Red Hat Enterprise Linux Server, Premium (8 sockets) (Up to 4 guests)
Provides:            Oracle Java (for RHEL Server)
                     Red Hat Software Collections Beta (for RHEL Server)
                     Red Hat Enterprise Linux Server
                     Red Hat Beta
SKU:                 RH0103708
Contract:            10743754
Account:             5581027
Serial:              7425559024960153644
Pool ID:             8a99f986515dc0cd015166cfe9c22b20
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       Premium
Service Type:        L1-L3
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              12/02/2015
Ends:                12/02/2016
System Type:         Virtual

2.remove this subscription
[root@localhost ~]# subscription-manager remove --serial=7425559024960153644
Serial numbers successfully removed at the server:
   7425559024960153644
1 local certificate has been deleted.

3.remove this subscripiton again
[root@localhost ~]# subscription-manager remove --serial=7425559024960153644
Serial numbers unsuccessfully removed at the server:
   7425559024960153644

4.list the consumed subscriptions and remove the subscription again
[root@localhost ~]# subscription-manager list --consumed
No consumed subscription pools to list
[root@localhost ~]# subscription-manager remove --serial=7425559024960153644
Serial numbers unsuccessfully removed at the server:
   7425559024960153644

Actual results:
as showed in steps 3

Expected results:
At step3 the output should be: No consumed subscription pools to remove.

Additional info:

Comment 2 qianzhan 2016-04-08 07:09:37 UTC
Reopen this bug.

When I tried to remove subscription with a nonexist serial number, it does not show notice like "Entitlement Certificate with serial number 2965 could not be found."

1) [root@dell-per630-fc-02 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.2.0.85-Unknown
subscription management rules: 5.16
subscription-manager: 1.16.8-8.el6
python-rhsm: 1.16.6-1.el6

2) Register to satellite6.1 and auto-attach.

3) Try to remove a non-exist subscription by wrong serial:
[root@dell-per630-fc-02 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   CloudForms (10-pack)
Provides:            Red Hat Beta
                     Oracle Java (for RHEL Server)
                     Red Hat CloudForms
                     Red Hat Software Collections (for RHEL Server)
                     Red Hat CloudForms Beta
                     Red Hat Enterprise Linux Server
                     Red Hat Software Collections Beta (for RHEL Server)
SKU:                 MCT2358
Contract:            10752428
Account:             5584289
Serial:              2965740756749361136
Pool ID:             2c90eca253f0f92b0153f0ffc02e0198
Provides Management: Yes
Active:              True
Quantity Used:       1
Service Level:       Premium
Service Type:        L1-L3
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              02/29/2016
Ends:                02/27/2017
System Type:         Physical

[root@dell-per630-fc-02 ~]# subscription-manager remove --serial 2965
Serial numbers unsuccessfully removed at the server:
   2965

4) Attachment is rhsm.log 'rhsm log for non-exist serial'

Comment 3 qianzhan 2016-04-08 07:10:00 UTC
Created attachment 1145030 [details]
rhsm log for non-exist serial

Comment 4 qianzhan 2016-04-08 08:26:47 UTC
(In reply to qianzhan from comment #2)

> 
> [root@dell-per630-fc-02 ~]# subscription-manager remove --serial 2965
> Serial numbers unsuccessfully removed at the server:
>    2965
> 

What's more, when I remove a subscription by an invalid serial number which inludes letters, the proper notice prompt:

[root@ibm-x3650-02 ~]# subscription-manager remove --serial 123s
Error: '123s' is not a valid serial number
[root@ibm-x3650-02 ~]# subscription-manager remove --serial 123
Serial numbers unsuccessfully removed at the server:
   123

Comment 5 John Sefler 2016-04-08 17:01:20 UTC
In my opinion, this is still not a bug...

The command line responses shown in comment 4 are true and correct...

> [root@ibm-x3650-02 ~]# subscription-manager remove --serial 123s
> Error: '123s' is not a valid serial number
That is true, '123s' is not a valid serial number.  Maybe the gave a typo.

> [root@ibm-x3650-02 ~]# subscription-manager remove --serial 123
> Serial numbers unsuccessfully removed at the server:
>    123
That is also true, '123' was not successfully remove.  Because there are many server-side reasons why a serial may not be removed successfully, you should take a look at the rhsm.log (see attachment 1145030 [details]) and you will find the following log statement that says:

2016-04-08 02:47:44,986 [ERROR] subscription-manager:40743 @managercli.py:1662 - Entitlement Certificate with serial number '2965' could not be found.

That is also true and is a very good reason why the serial was unsuccessfully removed.


My only suggestion for this bug is to alter the message to...
The entitlement server failed to remove these serials:

Comment 7 Chris Snyder 2016-04-08 17:43:25 UTC
We'll target a string change (as suggested by jsefler) in 6.9.

Comment 8 William Poteat 2016-06-14 12:28:07 UTC
master commit f64d5a6b012f49bb4d6d6653441d4de9bf373660


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