Bug 782775 - Different params for unsubscription in RHSM and Katello CLI
Summary: Different params for unsubscription in RHSM and Katello CLI
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: katello-agent
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: Unspecified
Assignee: Martin Bacovsky
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: katello-blockers
TreeView+ depends on / blocked
 
Reported: 2012-01-18 12:24 UTC by Martin Bacovsky
Modified: 2019-09-26 13:28 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-22 18:20:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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 ]


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