Bug 1285004 - subscription-manager remove --pool throws: Runtime Error Could not find resource for relative of full path
subscription-manager remove --pool throws: Runtime Error Could not find resou...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.8
Unspecified Unspecified
medium Severity high
: rc
: ---
Assigned To: Chris Snyder
Jan Stavel
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-24 11:16 EST by John Sefler
Modified: 2016-05-10 16:38 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-10 16:38:27 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:0797 normal SHIPPED_LIVE python-rhsm and subscription-manager bug fix and enhancement update 2017-01-06 11:31:50 EST

  None (edit)
Description John Sefler 2015-11-24 11:16:43 EST
Description of problem:
As a consequence of the initial implementation of Bug 1198178 "[RFE] Subscription-manager unsubscribe command should support --pool option"  an update had to be made to candlepin (something following 2.0.10-1) to support this feature.  The problem occurs when this new subscription-manager client feature is attempted against an older candlepin like the versions currently released in hosted production or stage (0.9.51.5-1).  This situation is not handled very gracefully by the subscription-manager client.


Version-Release number of selected component (if applicable):
[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.16.4-1.git.30.78442ab.el6.x86_64


How reproducible:


Steps to Reproduce:
[root@jsefler-6 ~]# subscription-manager register --serverurl=subscription.rhn.stage.redhat.com --username=stage_test_12 --auto-attach
Registering to: subscription.rhn.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: 585ed8bf-f3fe-4136-879c-f95cd675e47b 

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

[root@jsefler-6 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Red Hat Satellite Employee Subscription
Provides:            Red Hat Satellite
                     Red Hat Enterprise Linux Server
                     Red Hat Software Collections (for RHEL Server)
                     Red Hat Beta
                     Red Hat Satellite Beta
                     Red Hat Satellite 6 Beta
                     Red Hat Software Collections Beta (for RHEL Server)
                     Red Hat Satellite Capsule Beta
                     Red Hat Enterprise Linux Load Balancer (for RHEL Server)
                     Red Hat Satellite Capsule
                     Red Hat Satellite with Embedded Oracle
                     Red Hat Enterprise Linux High Availability (for RHEL
                     Server)
SKU:                 SER0232US
Contract:            
Account:             5563898
Serial:              8574735786394960446
Pool ID:             8a99f984508e9fbf01509432f22d052d
Provides Management: Yes
Active:              True
Quantity Used:       1
Service Level:       Self-Support
Service Type:        L1-L3
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              10/22/2015
Ends:                10/21/2016
System Type:         Physical

[root@jsefler-6 ~]# subscription-manager remove --pool=8a99f984508e9fbf01509432f22d052d
Serial numbers unsuccessfully removed at the server:
   Runtime Error Could not find resource for relative : /consumers/585ed8bf-f3fe-4136-879c-f95cd675e47b/entitlements/pool/8a99f984508e9fbf01509432f22d052d of full path: http://subscription.rhn.stage.redhat.com/candlepin/consumers/585ed8bf-f3fe-4136-879c-f95cd675e47b/entitlements/pool/8a99f984508e9fbf01509432f22d052d at org.jboss.resteasy.core.registry.PathParamSegment.matchPattern:209


Actual results:
   above

Expected results:
   Something more graceful indicating that...  The remove --pool option is not supported by the version of the entitlement server to which you are currently registered.  Instead, use the remove --serial option. 



Additional info:
[root@jsefler-6 ~]# tail -f /var/log/rhsm/rhsm.log
2015-11-24 10:57:39,653 [INFO] subscription-manager:15039 @managercli.py:357 - Client Versions: {'python-rhsm': '1.16.2-1.git.4.538d5f3.el6', 'subscription-manager': '1.16.4-1.git.30.78442ab.el6'}
2015-11-24 10:57:39,654 [INFO] subscription-manager:15039 @connection.py:788 - Connection built: host=subscription.rhn.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ verify=False
2015-11-24 10:57:39,655 [INFO] subscription-manager:15039 @connection.py:788 - Connection built: host=subscription.rhn.stage.redhat.com port=443 handler=/subscription auth=none
2015-11-24 10:57:39,656 [INFO] subscription-manager:15039 @managercli.py:333 - Consumer Identity name=jsefler-6.usersys.redhat.com uuid=585ed8bf-f3fe-4136-879c-f95cd675e47b
2015-11-24 10:57:39,688 [DEBUG] subscription-manager:15039 @connection.py:482 - Loaded CA certificates from /etc/rhsm/ca/: jsefler-os-candlepin.pem, redhat-uep.pem, jsefler-f22-candlepin.pem, jsefler-f14-candlepin.pem, jsefler-f22-6candlepin.pem
2015-11-24 10:57:39,693 [DEBUG] subscription-manager:15039 @connection.py:530 - Making request: DELETE /subscription/consumers/585ed8bf-f3fe-4136-879c-f95cd675e47b/entitlements/pool/8a99f984508e9fbf01509432f22d052d
2015-11-24 10:57:39,722 [DEBUG] subscription-manager:15039 @connection.py:482 - Loaded CA certificates from /etc/rhsm/ca/: jsefler-os-candlepin.pem, redhat-uep.pem, jsefler-f22-candlepin.pem, jsefler-f14-candlepin.pem, jsefler-f22-6candlepin.pem
2015-11-24 10:57:39,724 [DEBUG] subscription-manager:15039 @connection.py:530 - Making request: GET /subscription/
2015-11-24 10:57:40,189 [DEBUG] subscription-manager:15039 @connection.py:562 - Response: status=200
2015-11-24 10:57:40,193 [DEBUG] subscription-manager:15039 @connection.py:805 - Server supports the following resources: {'': '/', 'guestids': '/consumers/{consumer_uuid}/guestids', 'cdn': '/cdn', 'content_overrides': '/consumers/{consumer_uuid}/content_overrides', 'hypervisors': '/hypervisors', 'serials': '/serials', 'deleted_consumers': '/deleted_consumers', 'consumers': '/consumers', 'migrations': '/migrations', 'content': '/content', 'entitlements': '/entitlements', 'events': '/events', 'status': '/status', 'jobs': '/jobs', 'users': '/users', 'subscriptions': '/subscriptions', 'rules': '/rules', 'distributor_versions': '/distributor_versions', 'consumertypes': '/consumertypes', 'statistics/generate': '/statistics/generate', 'pools': '/pools', 'atom': '/atom', 'packages': '/consumers/{consumer_uuid}/packages', 'owners': '/owners', 'roles': '/roles', 'admin': '/admin', 'products': '/products', 'activation_keys': '/activation_keys', 'crl': '/crl'}
2015-11-24 10:57:40,195 [DEBUG] subscription-manager:15039 @connection.py:482 - Loaded CA certificates from /etc/rhsm/ca/: jsefler-os-candlepin.pem, redhat-uep.pem, jsefler-f22-candlepin.pem, jsefler-f14-candlepin.pem, jsefler-f22-6candlepin.pem
2015-11-24 10:57:40,196 [DEBUG] subscription-manager:15039 @connection.py:530 - Making request: GET /subscription/status
2015-11-24 10:57:40,316 [DEBUG] subscription-manager:15039 @connection.py:562 - Response: status=404
2015-11-24 10:57:40,336 [DEBUG] subscription-manager:15039 @connection.py:482 - Loaded CA certificates from /etc/rhsm/ca/: jsefler-os-candlepin.pem, redhat-uep.pem, jsefler-f22-candlepin.pem, jsefler-f14-candlepin.pem, jsefler-f22-6candlepin.pem
2015-11-24 10:57:40,337 [DEBUG] subscription-manager:15039 @connection.py:530 - Making request: GET /subscription/consumers/585ed8bf-f3fe-4136-879c-f95cd675e47b/certificates/serials
2015-11-24 10:57:40,701 [DEBUG] subscription-manager:15039 @connection.py:562 - Response: status=200, requestUuid=5081270e-08ad-49a0-b1a7-934b78032bc5
2015-11-24 10:57:40,705 [INFO] subscription-manager:15039 @managercli.py:368 - Server Versions: {'rules-version': '5.15', 'candlepin': '0.9.51.5-1', 'server-type': 'Red Hat Subscription Management'}
2015-11-24 10:57:40,945 [DEBUG] subscription-manager:15039 @connection.py:562 - Response: status=200, requestUuid=c8bbbd99-a31a-453f-bf6d-7c315baea2bb
2015-11-24 10:57:40,950 [INFO] subscription-manager:15039 @entcertlib.py:131 - certs updated:
Total updates: 0
Found (local) serial# [8574735786394960446L]
Expected (UEP) serial# [8574735786394960446]
Added (new)
  <NONE>
Deleted (rogue):
  <NONE>
Comment 1 Chris Snyder 2015-11-25 15:08:13 EST
A PR with new implementation of the original RFE that avoids this situation entirely by not using any new candlepin api methods is available at the link below:

https://github.com/candlepin/subscription-manager/pull/1348
Comment 2 Chris Snyder 2015-12-02 13:18:44 EST
Two PRs that solve this bug in the initial implementation:

https://github.com/candlepin/candlepin/pull/1033

https://github.com/candlepin/subscription-manager/pull/1355
Comment 3 John Sefler 2015-12-03 17:04:35 EST
Testing Version....

[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.16.5-1.git.50.2a52dfd.el6.x86_64


[root@jsefler-6 ~]# subscription-manager unsubscribe --pool=1234567890abcdef1234567890abcdef 1>/tmp/stdout 2>/tmp/stderr
[root@jsefler-6 ~]# echo $?
69
[root@jsefler-6 ~]# cat /tmp/stdout
Error: The registered entitlement server does not support remove --pool.
Instead, use the remove --serial option.
[root@jsefler-6 ~]# cat /tmp/stderr
[root@jsefler-6 ~]# 

With a non-zero exitCode of 69 (EX_UNAVAILABLE), notice that the error message is being written to stdout.  For consistency with other errors, this should be written to stderr.
Comment 4 Chris Snyder 2015-12-09 12:06:30 EST
John,

As of the below a fix for your comment has been put into master

commit d9a82d3135a1770f794c2c8181f44e7e4628e0b6
Author: Christopher Snyder <csnyder@redhat.com>
Date:   Fri Dec 4 11:50:54 2015 -0500

    Output of errors now goes to stderr
Comment 6 Shwetha Kallesh 2015-12-10 06:42:02 EST
Failed_qa as the error is still being written to stdout

[root@pogo-cn1100-01 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.11-1
subscription management rules: 5.15
subscription-manager: 1.16.6-1.el6
python-rhsm: 1.16.4-1.el6


[root@pogo-cn1100-01 ~]# subscription-manager remove --pool 8a85f9843affb61f013b1fae79e26a75
Error: The registered entitlement server does not support remove --pool.
Instead, use the remove --serial option.

[root@pogo-cn1100-01 ~]# subscription-manager remove --pool 8a85f9843affb61f013b1fae79e26a75 1>/tmp/stdout 2>/tmp/stderr

[root@pogo-cn1100-01 ~]# cat /tmp/stderr 
[root@pogo-cn1100-01 ~]# cat /tmp/stdout 
Error: The registered entitlement server does not support remove --pool.
Instead, use the remove --serial option.
Comment 7 Chris Snyder 2015-12-16 13:57:42 EST
The commit listed in comment 4 was not pulled in to the present build (subman 1.16.6-1.el6). It is now in master and should be pulled in to the next build after we tag. Due to this I am moving the bug back to modified.
The next build will be done in January.
Comment 11 Jan Stavel 2016-01-22 12:27:41 EST
The bug is verified.

[root@localhost ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.8 Beta (Santiago)

[root@localhost ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.15-1
subscription management rules: 5.15.1
subscription-manager: 1.16.7-1.el6
python-rhsm: 1.16.5-1.el6


[root@localhost ~]# subscription-manager remove --pool=8a85f9823e3d5e43013e3ddd4e9509c4
Error: The registered entitlement server does not support remove --pool.
Instead, use the remove --serial option.
[root@localhost ~]#
Comment 12 Jan Stavel 2016-01-22 13:31:55 EST
I have added informations about stdout, stderr using:

[root@localhost ~]# subscription-manager remove --pool=8a85f9823e3d5e43013e3ddd4e9509c4 1> /tmp/stdout 2> /tmp/stderr

[root@localhost ~]# echo $?
69

[root@localhost ~]# cat /tmp/stdout 

[root@localhost ~]# cat /tmp/stderr 
Error: The registered entitlement server does not support remove --pool.
Instead, use the remove --serial option.
Comment 13 Jan Stavel 2016-01-25 07:13:53 EST
It was verified:

root@localhost ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.8 Beta (Santiago)

[root@localhost ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.15-1
subscription management rules: 5.15.1
subscription-manager: 1.16.7-1.el6
python-rhsm: 1.16.5-1.el6


[root@localhost ~]# subscription-manager remove --pool=8a85f9823e3d5e43013e3ddd4e9509c4 1> /tmp/stdout 2> /tmp/stderr

[root@localhost ~]# echo $?
69

[root@localhost ~]# cat /tmp/stdout 

[root@localhost ~]# cat /tmp/stderr 
Error: The registered entitlement server does not support remove --pool.
Instead, use the remove --serial option.
Comment 15 errata-xmlrpc 2016-05-10 16:38:27 EDT
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://rhn.redhat.com/errata/RHBA-2016-0797.html

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