Bug 773521 - Help text should include "entitlement ID" instead of "pool id" when un-subscribing a product
Summary: Help text should include "entitlement ID" instead of "pool id" when un-subscr...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
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-12 06:32 UTC by Sachin Ghai
Modified: 2019-09-26 13:28 UTC (History)
1 user (show)

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


Attachments (Terms of Use)

Description Sachin Ghai 2012-01-12 06:32:53 UTC
Description of problem:
I registered a machine using rhsm and subscribe to rhel62 repo. Repo was subscribed successfully.

However when I tried to change the subscription from server and tried to unsubscribe the product, got following message:

RestClient::ResourceNotFound: Candlepin::Consumer: 404 Resource Not Found {"displayMessage":"Entitlement with ID '8ac1493b34cce2010134cdc979370027' could not be found."} (DELETE /candlepin/consumers/0ee22dc7-9f41-4a77-8052-4a1511c4e9b0/entitlements

available subscriptions:
==========================
katello> system subscriptions --org ACME_Corporation --name dhcp193-155.pnq.redhat.com --available
----------------------------------------------------------------------------
         Available Pools for System [ dhcp193-155.pnq.redhat.com ]
----------------------------------------------------------------------------

PoolId:           8ac1493b34cce2010134d06a57b0005e
PoolName:         aeolus
Expires:          01/04/2042
Consumed:         0
Quantity:         -1
Sockets:          
MultiEntitlement: False
ProvidedProducts: []




katello> org subscriptions --name ACME_Corporation----------------------------------------------------------------------------
                        Organization's Subscriptions
----------------------------------------------------------------------------

ProductName:    Red Hat Enterprise Linux Server, Self-support (1-2 sockets) (Up to 1 guest)
Consumed:       0
ContractNumber: 2635101
Sla:            
Id:             8ac1493b34cce2010134d07373700066
StartDate:      2011/11/18 05:00:00
EndDate:        2012/11/18 04:59:59


ProductName:    aeolus
Consumed:       0
ContractNumber: 
Sla:            
Id:             8ac1493b34cce2010134d06a57b0005e
StartDate:      2012/01/12 00:00:00
EndDate:        2042/01/04 00:00:00


ProductName:    Red Hat Enterprise Linux Server, Self-support (1-2 sockets) (Up to 1 guest)
Consumed:       1
ContractNumber: 2635101
Sla:            
Id:             8ac1493b34cce2010134cdc979370027
StartDate:      2011/11/18 05:00:00
EndDate:        2012/11/18 04:59:59

katello> 

katello> system unsubscribe --org ACME_Corporation --name dhcp193-155.pnq.redhat.com --pool 8ac1493b34cce2010134cdc979370027
RestClient::ResourceNotFound: Candlepin::Consumer: 404 Resource Not Found {"displayMessage":"Entitlement with ID '8ac1493b34cce2010134cdc979370027' could not be found."} (DELETE /candlepin/consumers/0ee22dc7-9f41-4a77-8052-4a1511c4e9b0/entitlements/8ac1493b34cce2010134cdc979370027)
katello> 



Version-Release number of selected component (if applicable):
[root@dhcp201-187 ~]# rpm -qa | grep katello
katello-glue-candlepin-0.1.174-2.el6.noarch
katello-httpd-ssl-key-pair-1.0-1.noarch
katello-certs-tools-1.0.1-2.el6.noarch
katello-common-0.1.174-2.el6.noarch
katello-cli-0.1.34-2.el6.noarch
katello-glue-pulp-0.1.174-2.el6.noarch
katello-trusted-ssl-cert-1.0-1.noarch
katello-cli-common-0.1.34-2.el6.noarch
katello-configure-0.1.52-2.el6.noarch
katello-glue-foreman-0.1.174-2.el6.noarch
katello-all-0.1.174-2.el6.noarch
katello-0.1.174-2.el6.noarch
katello-qpid-broker-key-pair-1.0-1.noarch

[root@dhcp193-155 ~]# rpm -qa | grep -ie subscription-manager -ie python-rhsm
subscription-manager-0.98.8-1.el5.x86_64
python-rhsm-0.97.1-1.el6.noarch
[root@dhcp193-155 ~]# 





How reproducible:
always

Steps to Reproduce:
1. Register a node using rhsm
2. subscribe a product from client using rhsm
3. unsubscribe from katello server
  
Actual results:
RestClient::ResourceNotFound: Candlepin::Consumer: 404 Resource Not Found {"displayMessage":"Entitlement with ID '8ac1493b34cce2010134cdc979370027' could not be found."} (DELETE /candlepin/consumers/0ee22dc7-9f41-4a77-8052-4a1511c4e9b0/entitlements/8ac1493b34cce2010134cdc979370027)
katello> 



Expected results:
Product should be unsubscribed from the server side successfully

Additional info:

production.log:
================


Started DELETE "/katello///api/systems/0ee22dc7-9f41-4a77-8052-4a1511c4e9b0/subscriptions/8ac1493b34cce2010134cdc979370027" for 127.0.0.1 at Thu Jan 12 11:49:58 +0530 2012
  Processing by Api::SubscriptionsController#destroy as JSON
  Parameters: {"system_id"=>"0ee22dc7-9f41-4a77-8052-4a1511c4e9b0", "id"=>"8ac1493b34cce2010134cdc979370027"}
Unsubscribing from entitlement '8ac1493b34cce2010134cdc979370027' for : dhcp193-155.pnq.redhat.com
exception when talking to a remote client: Candlepin::Consumer: 404 Resource Not Found {"displayMessage":"Entitlement with ID '8ac1493b34cce2010134cdc979370027' could not be found."} (DELETE /candlepin/consumers/0ee22dc7-9f41-4a77-8052-4a1511c4e9b0/entitlements/8ac1493b34cce2010134cdc979370027) RestClient::ResourceNotFound: Candlepin::Consumer: 404 Resource Not Found {"displayMessage":"Entitlement with ID '8ac1493b34cce2010134cdc979370027' could not be found."} (DELETE /candlepin/consumers/0ee22dc7-9f41-4a77-8052-4a1511c4e9b0/entitlements/8ac1493b34cce2010134cdc979370027)
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:48:in `return!'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:220:in `process_result'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:169:in `transmit'
/usr/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:80:in `delete'
/usr/share/katello/lib/http_resource.rb:128:in `delete'
/usr/share/katello/lib/resources/candlepin.rb:150:in `remove_entitlement'
/usr/share/katello/app/models/glue/candlepin/consumer.rb:134:in `unsubscribe'
/usr/share/katello/app/controllers/api/subscriptions_controller.rb:44:in `destroy'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:150:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rendering.rb:11:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/callbacks.rb:18:in `process_action'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:452:in `_run__1587206553__process_action__988268021__callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:221:in `_conditional_callback_around_2623'
/usr/share/katello/lib/util/threadsession.rb:79:in `thread_locals'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:220:in `_conditional_callback_around_2623'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:441:in `_run__1587206553__process_action__988268021__callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `run_callbacks'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/callbacks.rb:17:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rescue.rb:17:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:119:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:41:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal.rb:138:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal.rb:178:in `action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:27:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/route_set.rb:150:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:93:in `recognize'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:82:in `optimized_each'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:92:in `recognize'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/route_set.rb:141:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:493:in `call'
/usr/lib/ruby/gems/1.8/gems/warden-1.0.5/lib/warden/manager.rb:35:in `call'
/usr/lib/ruby/gems/1.8/gems/warden-1.0.5/lib/warden/manager.rb:34:in `catch'
/usr/lib/ruby/gems/1.8/gems/warden-1.0.5/lib/warden/manager.rb:34:in `call'
/usr/lib/ruby/gems/1.8/gems/sass-3.1.4/lib/sass/../sass/plugin/rack.rb:54:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/head.rb:14:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/methodoverride.rb:24:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/flash.rb:182:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/cookies.rb:302:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:32:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:12:in `cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:31:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:46:in `call'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/sendfile.rb:102:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/rack/logger.rb:13:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/runtime.rb:17:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/lock.rb:34:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:168:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:77:in `send'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:77:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/urlmap.rb:52:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/urlmap.rb:46:in `each'
/usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/urlmap.rb:46:in `call'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:84:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in `catch'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:57:in `process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:42:in `receive_data'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/server.rb:159:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/controllers/controller.rb:86:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `send'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `run_command'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/bin/thin:6
/usr/share/katello/script/thin:59:in `load'
/usr/share/katello/script/thin:59
Rendered text template (0.0ms)
Completed 404 Not Found in 94ms (Views: 0.6ms | ActiveRecord: 2.7ms)


Also this time, server and client clocks are in sync.

Comment 1 Garik Khachikyan 2012-01-12 12:16:52 UTC
Sachin,

You need to specify not the poolid but the EntitlementId that you need to unsubscribe your system from.

How to get that? simply make api call: 
system subscriptions --name <your_rhel_client_registered_to_katello> --org <org>

and then provide the id from there in the `system unsubscribe --pool <id_here>`

doing that really works for me.

Comment 2 Sachin Ghai 2012-01-12 12:35:15 UTC
Thanks much Garik. This way I was able to unsubscribe the product. 

Since we are passing the entitlement id to unsubscribe the product then I think following help text needs to be updated.

--
katello> system unsubscribe --org ACME_Corporation --name dhcp193-155.pnq.redhat.com --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)
  --pool=POOL   pool id to unsubscribe from (required)
---



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

EntitlementId:    8ac1493b34cce2010134d117b9c7009b
PoolName:         aeolus
Expires:          01/04/2042
Consumed:         1
Quantity:         1
Sla:              
ContractNumber:   
ProvidedProducts: []


katello> system unsubscribe --org ACME_Corporation --name dhcp193-155.pnq.redhat.com --pool 8ac1493b34cce2010134d117b9c7009b
Successfully unsubscribed System [ dhcp193-155.pnq.redhat.com ]
katello>

Comment 3 Garik Khachikyan 2012-01-12 12:39:28 UTC
@bkearney

also please confirm that there is no way recently through RHSM to retrieve the entitlement id(s) for the system subscriptions.

Comment 5 Martin Bacovsky 2012-01-24 13:06:16 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 6 Sachin Ghai 2012-01-25 12:22:45 UTC
Verified with following katello build:

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

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>

Comment 7 Sachin Ghai 2012-01-25 12:25:57 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.