Bug 1339211

Summary: 'hammer activation-key subscriptions' shows already removed subscriptions
Product: Red Hat Satellite Reporter: Andrii Balakhtar <abalakht>
Component: HammerAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, cwelton, jcallaha, mmccune
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/15272
Whiteboard:
Fixed In Version: rubygem-hammer_cli_katello-0.0.22.18-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:42:46 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 Andrii Balakhtar 2016-05-24 11:58:58 UTC
Description of problem:
After successful subscription removal from activation key, hammer's  'activation-key subscriptions' command still shows subscription is associated to activation key.
It's not an issue with removal, as changes are reflected correctly via WebUI (and subscription will be shown by 'activation-key subscriptions' command even if you removed it via WebUI)

Version-Release number of selected component (if applicable):
Satellite 6.2.0 GA SNAP 12.1

How reproducible:
Always

Steps to Reproduce:
1. Add subscription to activation key:
hammer activation-key add-subscription --subscription-id="10" --id="2"
2. Make sure subscription was added:
hammer activation-key subscriptions --id="2" --organization-id="47"
3. Remove subscription:
hammer activation-key remove-subscription --subscription-id="10" --id="2"
4. Ensure subscription was removed with 'hammer activation-key subscriptions' command:
hammer activation-key subscriptions --id="2" --organization-id="47"


Actual results:
Subscription is still listed:

---|-----------------------------------------------------------|----------|----------|---------------------|---------------------|--------------|----------|--------
ID | NAME                                                      | ATTACHED | QUANTITY | START DATE          | END DATE            | SUPPORT      | CONTRACT | ACCOUNT
---|-----------------------------------------------------------|----------|----------|---------------------|---------------------|--------------|----------|--------
10 | Red Hat Enterprise Linux Server Entry Level, Self-support | 0 of 25  |          | 2015/10/14 04:00:00 | 2016/10/14 03:59:59 | Self-Support | 10800893 | 477931 
---|-----------------------------------------------------------|----------|----------|---------------------|---------------------|--------------|----------|--------

Expected results:
'hammer activation-key subscriptions' should not show the subscription, which was removed from activation key.

Additional info:

Comment 3 Corey Welton 2016-05-24 17:19:57 UTC
Possibly triggered by 
https://bugzilla.redhat.com/show_bug.cgi?id=1330311 ?

Comment 4 Andrew Kofink 2016-06-02 17:10:59 UTC
Created redmine issue http://projects.theforeman.org/issues/15272 from this bug

Comment 5 Bryan Kearney 2016-06-17 14:15:12 UTC
Upstream bug component is Content Management

Comment 6 Bryan Kearney 2016-06-22 18:16:45 UTC
Upstream bug component is Hammer

Comment 7 jcallaha 2016-07-06 18:18:55 UTC
Verified in Satellite 6.2 beta Snap 19.

[root@rhsm-qe-1 backup]# hammer activation-key subscriptions --id 2 --organization-id 1
---|-----------------------------------------|----------|----------|---------------------|---------------------|--------------|----------|--------
ID | NAME                                    | ATTACHED | QUANTITY | START DATE          | END DATE            | SUPPORT      | CONTRACT | ACCOUNT
---|-----------------------------------------|----------|----------|---------------------|---------------------|--------------|----------|--------
4  | custom                                  |          |          | 2016/06/20 13:37:56 | 2046/06/13 13:37:56 |              |          |        
11 | Red Hat Satellite Employee Subscription |          |          | 2014/09/19 04:00:00 | 2022/01/01 04:59:59 | Self-Support | 10538625 | 477931 
20 | Employee SKU                            |          |          | 2013/04/24 04:00:00 | 2022/01/01 04:59:59 | Self-Support | 10169793 | 477931 
---|-----------------------------------------|----------|----------|---------------------|---------------------|--------------|----------|--------
[root@rhsm-qe-1 backup]# hammer activation-key remove-subscription --subscription-id 4 --id 2 --organization-id 1
Subscription removed from activation key
[root@rhsm-qe-1 backup]# hammer -u admin -p changeme activation-key subscriptions --id 2 --organization-id 1
---|-----------------------------------------|----------|----------|---------------------|---------------------|--------------|----------|--------
ID | NAME                                    | ATTACHED | QUANTITY | START DATE          | END DATE            | SUPPORT      | CONTRACT | ACCOUNT
---|-----------------------------------------|----------|----------|---------------------|---------------------|--------------|----------|--------
11 | Red Hat Satellite Employee Subscription |          |          | 2014/09/19 04:00:00 | 2022/01/01 04:59:59 | Self-Support | 10538625 | 477931 
20 | Employee SKU                            |          |          | 2013/04/24 04:00:00 | 2022/01/01 04:59:59 | Self-Support | 10169793 | 477931 
---|-----------------------------------------|----------|----------|---------------------|---------------------|--------------|----------|--------

Comment 8 Bryan Kearney 2016-07-27 11:42:46 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-2016:1501