Bug 1402009 - subscription-manager stdout contains ESC[?1034h
Summary: subscription-manager stdout contains ESC[?1034h
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.9
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 6.9
Assignee: Kevin Howell
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-06 15:01 UTC by Rehana
Modified: 2017-03-21 10:57 UTC (History)
6 users (show)

Fixed In Version: subscription-manager-1.18.8-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-21 10:57:52 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github candlepin subscription-manager pull 1530 None None None 2016-12-09 18:27:40 UTC
Red Hat Product Errata RHSA-2017:0698 normal SHIPPED_LIVE Moderate: subscription-manager security, bug fix, and enhancement update 2017-03-21 12:39:12 UTC

Description Rehana 2016-12-06 15:01:17 UTC
Description of problem:
This is issue is observed on both 0.9 and 2.0 candlepin deployments. Here is a demo from stage env

Version-Releasubscription management server: 0.9.51.20-1
subscription management rules: 5.15.1
subscription-manager: 1.18.5-1.el6
python-rhsm: 1.18.5-1.el6
se number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1.Register client to stage server
2.Try to attach using the command
# subscription-manager list --available  --match-installed --no-overlap --pool-only | subscription-manager attach --file -

3.

Actual results:
first pool from the list fails with not found error
#subscription-manager list --available  --match-installed --no-overlap --pool-only | subscription-manager attach --file -
Pool with id 8a99f983582a9598015843b018d74412 could not be found.
Successfully attached a subscription for: Red Hat Enterprise Linux Server, Premium (Physical or Virtual Nodes)

Note : i could manually attach the failed pool id successfully 

# subscription-manager attach --pool 8a99f983582a9598015843b018d74412
Successfully attached a subscription for: Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes)


Expected results:
no failures are expected

Additional info:
2016-12-06 07:03:33,118 [INFO] subscription-manager:31685:MainThread @connection.py:525 - Response: status=200, requestUuid=22463289-82d5-4807-9986-3e4273a684e1, request="GET /subscription/consumers/53581475-3342-409e-861c-aceb8e907cfc"
2016-12-06 07:03:33,708 [INFO] subscription-manager:31685:MainThread @connection.py:525 - Response: status=200, requestUuid=7fa62bfb-4507-4cdd-8f71-d08ca8bc6e0d, request="GET /subscription/"
2016-12-06 07:03:34,312 [INFO] subscription-manager:31685:MainThread @connection.py:525 - Response: status=200, requestUuid=4cedb374-69a8-4b12-a477-c61205b8dc09, request="GET /subscription/consumers/53581475-3342-409e-861c-aceb8e907cfc/content_overrides"
2016-12-06 07:03:34,326 [INFO] subscription-manager:31685:MainThread @repolib.py:309 - repos updated: Repo updates
 
Total repo updates: 0
Updated
    <NONE>
Added (new)
    <NONE>
Deleted
    <NONE>
2016-12-06 07:03:34,535 [INFO] subscription-manager:31685:MainThread @hwprobe.py:918 - collected virt facts: virt.is_guest=False, virt.host_type=Not Applicable, virt.uuid=Not Set
2016-12-06 07:03:34,537 [INFO] subscription-manager:31685:MainThread @cache.py:398 - Server does not support packages, skipping profile upload.
2016-12-06 07:03:35,158 [INFO] subscription-manager:31685:MainThread @connection.py:525 - Response: status=404, request="POST /subscription/consumers/53581475-3342-409e-861c-aceb8e907cfc/entitlements?pool=%1B%5B%3F1034h8a99f983582a9598015843b018d74412"
2016-12-06 07:03:35,159 [ERROR] subscription-manager:31685:MainThread @managercli.py:1587 - Pool with id 8a99f983582a9598015843b018d74412 could not be found.
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/subscription_manager/managercli.py", line 1577, in _do_command
    ents = self.cp.bindByEntitlementPool(self.identity.uuid, pool, self.options.quantity)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1097, in bindByEntitlementPool
    return self.conn.request_post(method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 626, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 534, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 587, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: Pool with id 8a99f983582a9598015843b018d74412 could not be found.
2016-12-06 07:03:37,234 [INFO] subscription-manager:31685:MainThread @connection.py:525 - Response: status=200, requestUuid=f4447276-6396-42b1-a900-34226a9fdbfb, request="POST /subscription/consumers/53581475-3342-409e-861c-aceb8e907cfc/entitlements?pool=8a99f984582a959f015871f839fa4ab3"
2016-12-06 07:03:37,238 [INFO] subscription-manager:31685:MainThread @managercli.py:1584 - Successfully attached a subscription for: Red Hat Enterprise Linux Server, Premium (Physical or Virtual Nodes) (8a99f984582a959f015871f839fa4ab3)
2016-12-06 07:03:37,881 [INFO] subscription-manager:31685:MainThread @connection.py:525 - Response: status=200, requestUuid=d5bf093d-5b9a-423b-8487-674f2dcd780c, request="GET /subscription/consumers/53581475-3342-409e-861c-aceb8e907cfc/certificates/serials"
2016-12-06 07:03:38,475 [INFO] subscription-manager:31685:MainThread @connection.py:525 - Response: status=200, requestUuid=8f3a5424-3f2f-41f9-89fd-5aa857752b53, request="GET /subscription/consumers/53581475-3342-409e-861c-aceb8e907cfc/certificates?serials=648305297802644465"
2016-12-06 07:03:38,487 [INFO] subscription-manager:31685:MainThread @entcertlib.py:131 - certs updated:
Total updates: 1
Found (local) serial# []
Expected (UEP) serial# [648305297802644465]
Added (new)
  [sn:648305297802644465 (Red Hat Enterprise Linux High Performance Networking (for RHEL Server) - Extended Update Support,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Oracle Java (for RHEL Server),) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Enterprise Linux Server - Extended Update Support,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Enterprise Linux Server,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Enterprise Linux Atomic Host,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat EUCJP Support (for RHEL Server) - Extended Update Support,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Enterprise Linux Resilient Storage (for RHEL Server) - Extended Update Support,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Oracle Java (for RHEL Server) - Extended Update Support,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (dotNET on RHEL Beta (for RHEL Server),) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Beta,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Software Collections (for RHEL Server),) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (dotNET on RHEL (for RHEL Server),) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Developer Toolset (for RHEL Server),) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Enterprise Linux Atomic Host Beta,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Enterprise Linux High Availability (for RHEL Server) - Extended Update Support,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Enterprise Linux Scalable File System (for RHEL Server) - Extended Update Support,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Enterprise Linux Load Balancer (for RHEL Server) - Extended Update Support,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Software Collections Beta (for RHEL Server),) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Container Images,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat Container Images Beta,) @ /etc/pki/entitlement/648305297802644465.pem]
  [sn:648305297802644465 (Red Hat S-JIS Support (for RHEL Server) - Extended Update Support,) @ /etc/pki/entitlement/648305297802644465.pem]
Deleted (rogue):
  <NONE>
2016-12-06 07:03:39,089 [INFO] subscription-manager:31685:MainThread @connection.py:525 - Response: status=200, requestUuid=07f1ceb7-045c-4066-b2e2-bf15574d00fa, request="GET /subscription/consumers/53581475-3342-409e-861c-aceb8e907cfc/content_overrides"
2016-12-06 07:03:39,709 [INFO] subscription-manager:31685:MainThread @connection.py:525 - Response: status=200, requestUuid=b75a1373-98ef-4924-bfb1-ae55a7ed05bd, request="GET /subscription/consumers/53581475-3342-409e-861c-aceb8e907cfc/release"
2016-12-06 07:03:39,789 [INFO] subscription-manager:31685:MainThread @repolib.py:309 - repos updated: Repo updates

Comment 1 John Sefler 2016-12-06 16:15:57 UTC
Also fails for me on  subscription-manager-1.18.5-1.el6   RHEL69
It does NOT happen on subscription-manager-1.17.15-1.el7  RHEL73
It does NOT happen on subscription-manager-1.16.8-8.el7   RHEL68
Therefore it is a regression.

Reviewing rhsm.log, you'll see that the first poolid from the stdin pipe gets prefixed with some extraneous chars "%1B%5B%3F1034h" which certainly will not be found on the server...

@connection.py:525 - Response: status=404, request="POST /subscription/consumers/53581475-3342-409e-861c-aceb8e907cfc/entitlements?pool=%1B%5B%3F1034h8a99f983582a9598015843b018d74412"


This fails....

[root@jsefler-rhel6 ~]# subscription-manager list --available --match-installed --pool-only | subscription-manager attach --file -
Pool with id 8a99f9815582f734015585f99c47511c could not be found.
Successfully attached a subscription for: Red Hat Enterprise Linux Server, Premium (8 sockets) (Up to 4 guests)
Successfully attached a subscription for: Red Hat Enterprise Linux Server, Premium (Physical or Virtual Nodes)
[root@jsefler-rhel6 ~]# 


This fails too...

[root@jsefler-rhel6 ~]# subscription-manager list --available --match-installed --pool-only > file_of_pool_ids
[root@jsefler-rhel6 ~]# subscription-manager attach --file file_of_pool_ids
Pool with id 8a99f9815582f734015585f99c47511c could not be found.
Successfully attached a subscription for: Red Hat Enterprise Linux Server, Premium (8 sockets) (Up to 4 guests)
Successfully attached a subscription for: Red Hat Enterprise Linux Server, Premium (Physical or Virtual Nodes)
[root@jsefler-rhel6 ~]# 


Yet the file looks good...

[root@jsefler-rhel6 ~]# cat file_of_pool_ids 
8a99f9815582f734015585f99c47511c
8a99f9815582f734015585f99973509a
8a99f9815582f734015585f99e9d519d
[root@jsefler-rhel6 ~]# 


Once again, notice extraneous chars "%1B%5B%3F1034h" in my rhsm.log too...

2016-12-06 11:11:30,648 [INFO] subscription-manager:11395:MainThread @connection.py:525 - Response: status=404, request="POST /subscription/consumers/130d5672-aa98-49e0-91c4-c41692d5c9e6/entitlements?pool=%1B%5B%3F1034h8a99f9815582f734015585f99c47511c"
2016-12-06 11:11:30,649 [ERROR] subscription-manager:11395:MainThread @managercli.py:1587 - Pool with id ^[[?1034h8a99f9815582f734015585f99c47511c could not be found.
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/subscription_manager/managercli.py", line 1577, in _do_command
    ents = self.cp.bindByEntitlementPool(self.identity.uuid, pool, self.options.quantity)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1097, in bindByEntitlementPool
    return self.conn.request_post(method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 626, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 534, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 587, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: Pool with id ^[[?1034h8a99f9815582f734015585f99c47511c could not be found.

Comment 7 Shwetha Kallesh 2017-01-27 10:05:43 UTC
Subscription-manager list --avail output doesnot contain esc character anymore , so first pool gets attached successfully

[root@dhcp35-71 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.0.21-1
subscription management rules: 5.20
subscription-manager: 1.18.8-1.el6
python-rhsm: 1.18.6-1.el6


[root@dhcp35-71 ~]# subscription-manager list --available  --match-installed --no-overlap --pool-only | subscription-manager attach --file -
Successfully attached a subscription for: Awesome OS Unlimited Quantity Virt Limit
Successfully attached a subscription for: Stackable with Awesome OS for x86_64
Successfully attached a subscription for: Awesome OS Unlimited Quantity Virt Limit
Successfully attached a subscription for: RAM Limiting Package (2GB stackable)
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)
Successfully attached a subscription for: Multi-Attribute Stackable (2 GB)
Successfully attached a subscription for: Multi-Attribute Stackable (4 cores)
Successfully attached a subscription for: Admin OS Instance Based one socket
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)
Successfully attached a subscription for: Awesome OS for x86_64
Successfully attached a subscription for: Awesome OS with up to 4 virtual guests
Successfully attached a subscription for: Awesome OS Stackable guest limit 4
Successfully attached a subscription for: Awesome OS for All Arch (just x86_64 content)
Successfully attached a subscription for: Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390


[root@dhcp35-71 ~]# subscription-manager list --available --match-installed --pool-only > file.txt

[root@dhcp35-71 ~]# subscription-manager attach --file file.txt 
Successfully attached a subscription for: Awesome OS Unlimited Quantity Virt Limit
Successfully attached a subscription for: Stackable with Awesome OS for x86_64
Successfully attached a subscription for: Awesome OS Unlimited Quantity Virt Limit
Successfully attached a subscription for: RAM Limiting Package (2GB stackable)
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)
Successfully attached a subscription for: Multi-Attribute Stackable (2 GB)
Successfully attached a subscription for: Multi-Attribute Stackable (4 cores)
Successfully attached a subscription for: Admin OS Instance Based one socket
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)
Successfully attached a subscription for: Awesome OS for x86_64
Successfully attached a subscription for: Awesome OS with up to 4 virtual guests
Successfully attached a subscription for: Awesome OS Stackable guest limit 4
Successfully attached a subscription for: Awesome OS for All Arch (just x86_64 content)
Successfully attached a subscription for: Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390

Comment 9 errata-xmlrpc 2017-03-21 10:57:52 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://rhn.redhat.com/errata/RHSA-2017-0698.html


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