Bug 1371472

Summary: The count of subscriptions is not properly handled when removing subscriptions.
Product: Red Hat Enterprise Linux 7 Reporter: qianzhan
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED WONTFIX QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: csnyder, qianzhan, redakkan, skallesh
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-02 18:17:59 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:

Description qianzhan 2016-08-30 09:39:37 UTC
Description of problem:
The count of subscriptions is not properly handled when removing subscriptions.

Version-Release number of selected component (if applicable):
subscription-manager: 1.17.10-1.el7
python-rhsm: 1.17.6-1.el7


How reproducible:
always.

Steps to Reproduce:
1. Install RHEL-7.3-20160825.1.
2. Register and auto attach to prepare a valid entitlement cert.
[root@dhcp-129-48 ~]# subscription-manager register --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: new_test
Password: 
The system has been registered with ID: f694f0ee-9654-4c2f-b23d-b952fdf04cb6 

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

[root@dhcp-129-48 ~]# cat /etc/pki/entitlement/* > qq.pem
3. Remove all subscriptions, and the count of subscription is OKay,also the cert count.
[root@dhcp-129-48 ~]# subscription-manager remove --all
1 subscription removed at the server.
1 local certificate has been deleted.

4. Unregister the system, and import cert.
[root@dhcp-129-48 ~]# subscription-manager unregister
System has been unregistered.
[root@dhcp-129-48 ~]# subscription-manager import --cert qq.pem
Successfully imported certificate qq.pem

5. Remove all subscriptions.
[root@dhcp-129-48 ~]# subscription-manager remove --all
1 subscriptions removed from this system.
[root@dhcp-129-48 ~]# subscription-manager remove --all
0 subscriptions removed from this system.


Actual results:
As step 5.

Expected results:
The proper counts should be:
1) '1 subscription removed from this system.'
2) '0 subscription removed from this system.' Or 'No subscriptions removed from this system.'
Additional info:

Comment 2 Chris Snyder 2016-09-01 20:14:13 UTC
Not sure I see the bug here. The expected counts and the actual counts look the same to me. Are you asking us to change the plurality of the word 'subscription'?

Comment 3 qianzhan 2016-09-02 01:42:05 UTC
(In reply to Chris Snyder from comment #2)
> Not sure I see the bug here. The expected counts and the actual counts look
> the same to me. Are you asking us to change the plurality of the word
> 'subscription'?

Yes, Chris. Please modify the output information by removing 's' from 'subscriptions' in the 1 or 0 subscription scenario.

Comment 4 Chris Snyder 2016-09-02 18:17:59 UTC
I acknowledge that there is a grammatical error in the case that one subscription is removed. Given the amount of change necessary both in subscription-manager and in our tests I am closing this (as it only affects the one case and the counts are correct).