Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 782775

Summary: Different params for unsubscription in RHSM and Katello CLI
Product: Red Hat Satellite Reporter: Martin Bacovsky <mbacovsk>
Component: katello-agentAssignee: Martin Bacovsky <mbacovsk>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: bkearney, sghai
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 18:20:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 747354    

Description Martin Bacovsky 2012-01-18 12:24:33 UTC
Description of problem:
params needed to unsubscribe system in Katello CLI and RHSM differs:

CLI: system unsubscribe --org ACME_Corporation --name mbacovsk-test1.redhat.com --pool=ff80808134cde4dc0134d1ac03290027
(the --pool means in fact entitlement, it will be fixed)
RHSM: subscription-manager unsubscribe --serial=<serial>

CLI (as well as Candlepin API) uses entitlementId while RHSM uses serial.

Version-Release number of selected component (if applicable):
katello-cli-0.1.35
subscription-manager-0.99.4

How reproducible:
always

Expected results:
CLI and RHS use the same input for the same action

Comment 1 Martin Bacovsky 2012-01-18 12:27:13 UTC
Copied from inecas's comment on mailing list (for tracking purposes)
There are 3 ways how to unsubscribe in CP:

1. DELETE "/candlepin/consumers/d4b32e09-4bab-4fe2-a98b-ce7ec96cb8cb/certificates/6444937435662822417"
(used by subscription-manager unsubscribe --serial)

AND

2. DELETE /candlepin/consumers/d4b32e09-4bab-4fe2-a98b-ce7ec96cb8cb/entitlements/4028fa8134f045a10134f048a0ed0026
(used by katello unsubscribe)

AND

3. DELETE /candlepin/consumers/d4b32e09-4bab-4fe2-a98b-ce7ec96cb8cb/entitlements
(used by subscription-manager unsubscribe --all)

Comment 2 Martin Bacovsky 2012-01-24 13:02:08 UTC
Since katello-0.1.195-1 and katello-cli-0.1.41-1 the CLI is fixed as follows

CLI:
 system unsubscribe --org <org> --name <name> --entitlement <ent_id>
 system unsubscribe --org <org> --name <name> --serial <serial_id>
 system unsubscribe --org <org> --name <name> --all
    
Serial and entitlement ids are listed via:
 system subscrptions --org <org> --name <name>
Available pools via
 system subscrptions --org <org> --name <name> --available

Comment 3 Sachin Ghai 2012-01-25 12:37:00 UTC
Verified with following katello build:

katello-cli-0.1.42-1.el6.noarch
katello-0.1.195-1.el6.noarch


Now we can unsubscribe a product with entitlement id as well as serial cert id. And for unsubscription katello cli has same params as for rhsm ( i.e. --serial)

Help text is updated and includes entitlement instead of pool id. Also include
the serial id of certificate to unsubscribe the product.

katello> system unsubscribe --help
Usage: katello [options]

Options:
  -h, --help            show this help message and exit
  -g                    grep friendly output
  -v                    verbose, more structured output
  -d DELIMITER          grep friendly output column delimiter
  --org=ORG             organization name (required)
  --name=NAME           system name (required)
  --entitlement=ENTITLEMENT
                        entitlement id to unsubscribe from (either entitlement
                        or serial or all is required)
  --serial=SERIAL       serial id of a certificate to unsubscribe from (either
                        entitlement or serial or all is required)
  --all                 unsubscribe from all currently subscribed certificates
                        (either entitlement or serial or all is required)
katello>




katello> system subscriptions --org ACME_Corporation --name
dhcp193-78.pnq.redhat.com
----------------------------------------------------------------------------------------------
                Current Subscriptions for System [ dhcp193-78.pnq.redhat.com ]
----------------------------------------------------------------------------------------------

EntitlementId:     8ac1490f35138547013514be662b003b
Serial Id:         3219094884821188044
PoolName:          pulp
Expires:           01/17/2042
Consumed:          1
Quantity:          1
Sla:               
ContractNumber:    
Provided products:

Comment 4 Sachin Ghai 2012-01-25 12:37:21 UTC
Unsubscribing the system with entitlement id :success
======================================================

katello> system subscriptions --name dhcp193-78.pnq.redhat.com --org
ACME_Corporation
----------------------------------------------------------------------------------------------
                Current Subscriptions for System [ dhcp193-78.pnq.redhat.com ]
----------------------------------------------------------------------------------------------

EntitlementId:     8ac1490f35138547013514c8ce10003f
Serial Id:         7988125811537418628
PoolName:          pulp
Expires:           01/17/2042
Consumed:          1
Quantity:          1
Sla:               
ContractNumber:    
Provided products: 


katello> system unsubscribe --org ACME_Corporation --name
dhcp193-78.pnq.redhat.com --entitlement 8ac1490f35138547013514c8ce10003f
Successfully unsubscribed System [ dhcp193-78.pnq.redhat.com ]

Unsubscribing the system with serial cert id is also a success:
======================================================

katello> system subscriptions --org ACME_Corporation --name
dhcp193-78.pnq.redhat.com
----------------------------------------------------------------------------------------------
                Current Subscriptions for System [ dhcp193-78.pnq.redhat.com ]
----------------------------------------------------------------------------------------------

EntitlementId:     8ac1490f35138547013514be662b003b
Serial Id:         3219094884821188044
PoolName:          pulp
Expires:           01/17/2042
Consumed:          1
Quantity:          1
Sla:               
ContractNumber:    
Provided products: 



katello> system unsubscribe --org ACME_Corporation --name
dhcp193-78.pnq.redhat.com --serial  3219094884821188044
Successfully unsubscribed System [ dhcp193-78.pnq.redhat.com ]