Bug 1396405

Summary: Message "an integer is required" is displayed when tired to list release versions against stage server
Product: Red Hat Enterprise Linux 6 Reporter: Rehana <redakkan>
Component: python-rhsmAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.9CC: csnyder, redakkan, skallesh, vrjain
Target Milestone: rcKeywords: Regression, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 10:57:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rehana 2016-11-18 09:22:27 UTC
Description of problem:
Observed that 'subscription-manager release --list' against stage server from a rhel69 client having master build installed is displaying "an integer is required" on the terminal 

Version-Release number of selected component (if applicable):
subscription management server: 0.9.51.20-1
subscription management rules: 5.15.1
subscription-manager: 1.18.4-1.git.10.dfae74e.el6
python-rhsm: 1.18.4-1.git.9.bd3c973.el6


How reproducible:
always

Steps to Reproduce:
1.register rhel69 machine to stage and attach subscriptions
2. execute subscription-manager release --list
3.

Actual results:
[root@test home]# subscription-manager release --list
an integer is required


Expected results:
should list the release versions

Additional info:

rhsm log
--------
2016-11-18 04:17:54,438 [INFO] subscription-manager:9381:MainThread @connection.py:525 - Response: status=200, requestUuid=49ecf5b1-6061-4eff-a071-1765d11b78a8, request="GET /subscription/status"
2016-11-18 04:17:54,440 [INFO] subscription-manager:9381:MainThread @managercli.py:400 - Server Versions: {'rules-version': '5.15.1', 'candlepin': '0.9.51.20-1', 'server-type': 'Red Hat Subscription Management'}
2016-11-18 04:18:48,814 [INFO] subscription-manager:9438:MainThread @managercli.py:389 - Client Versions: {'python-rhsm': '1.18.4-1.git.9.bd3c973.el6', 'subscription-manager': '1.18.4-1.git.10.dfae74e.el6'}
2016-11-18 04:18:48,815 [INFO] subscription-manager:9438:MainThread @connection.py:758 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2016-11-18 04:18:48,816 [INFO] subscription-manager:9438:MainThread @connection.py:758 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=none
2016-11-18 04:18:48,816 [INFO] subscription-manager:9438:MainThread @managercli.py:364 - Consumer Identity name=test uuid=137df1fe-6b7f-4d5f-a4c8-e4b406e0be97
2016-11-18 04:18:55,065 [INFO] subscription-manager:9438:MainThread @connection.py:525 - Response: status=200, requestUuid=e74aa99c-2945-46e6-8f78-9e0e35d8bca1, request="GET /subscription/consumers/137df1fe-6b7f-4d5f-a4c8-e4b406e0be97"
2016-11-18 04:18:56,015 [INFO] subscription-manager:9438:MainThread @connection.py:525 - Response: status=200, requestUuid=368b2b14-4b6f-4bd6-a945-9d2b378c07a3, request="GET /subscription/"
2016-11-18 04:18:56,216 [ERROR] subscription-manager:9438:MainThread @managercli.py:177 - exception caught in subscription-manager
2016-11-18 04:18:56,216 [ERROR] subscription-manager:9438:MainThread @managercli.py:178 - an integer is required
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 81, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 72, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib/python2.6/site-packages/subscription_manager/managercli.py", line 2768, in main
    return CLI.main(self)
  File "/usr/lib/python2.6/site-packages/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/lib/python2.6/site-packages/subscription_manager/managercli.py", line 537, in main
    return_code = self._do_command()
  File "/usr/lib/python2.6/site-packages/subscription_manager/managercli.py", line 1458, in _do_command
    releases = self.release_backend.get_releases()
  File "/usr/lib/python2.6/site-packages/subscription_manager/release.py", line 48, in get_releases
    return provider.get_releases()
  File "/usr/lib/python2.6/site-packages/subscription_manager/release.py", line 125, in get_releases
    data = self.content_connection.get_versions(listing_path)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 327, in get_versions
    results = self._request("GET", handler, body="")
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 294, in _request
    "User-Agent": self.user_agent})
  File "/usr/lib64/python2.6/site-packages/rhsm/m2cryptohttp.py", line 163, in request
    return self._connection.request(method, handler, *args, **kwargs)
  File "/usr/lib64/python2.6/httplib.py", line 973, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.6/httplib.py", line 1010, in _send_request
    self.endheaders()
  File "/usr/lib64/python2.6/httplib.py", line 967, in endheaders
    self._send_output()
  File "/usr/lib64/python2.6/httplib.py", line 831, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.6/httplib.py", line 790, in send
    self.connect()
  File "/usr/lib64/python2.6/site-packages/rhsm/m2cryptohttp.py", line 132, in connect
    sock.connect((self.host, self.port))
  File "/usr/lib64/python2.6/site-packages/M2Crypto/SSL/Connection.py", line 181, in connect
    self.socket.connect(addr)
  File "<string>", line 1, in connect
TypeError: an integer is required
-----

curl list the release versions
===========================
[root@test home]# curl --stderr /dev/null --insecure --tlsv1 --cert /etc/pki/entitlement/3625012093715461333.pem --key /etc/pki/entitlement/3625012093715461333-key.pem https://cdn.redhat.com/content/dist/rhel/server/6/listing
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6Server

Comment 3 Chris Snyder 2016-11-22 15:37:47 UTC
I have attached a PR with a fix.

Comment 6 Rehana 2016-12-12 10:58:43 UTC
Retested with ;

subscription management server: 0.9.51.20-1
subscription management rules: 5.15.1
subscription-manager: 1.18.6-1.el6
python-rhsm: 1.18.6-1.el6

observed that now "release" listing works against stage candlepin server 

[root@dhcp70-150 ~]# subscription-manager register --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: <username>
Password: 
The system has been registered with ID: d6d038a3-a0f7-4791-9269-894c53d899b2 

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

[root@dhcp70-150 ~]# subscription-manager release --list
+-------------------------------------------+
          Available Releases
+-------------------------------------------+
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6Server

rhsm.log:
=========
2016-12-12 05:13:45,242 [INFO] subscription-manager:28211:MainThread @managercli.py:389 - Client Versions: {'python-rhsm': '1.18.6-1.el6', 'subscription-manager': '1.18.6-1.el6'}
2016-12-12 05:13:45,242 [INFO] subscription-manager:28211:MainThread @connection.py:758 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2016-12-12 05:13:45,243 [INFO] subscription-manager:28211:MainThread @connection.py:758 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=none
2016-12-12 05:13:45,243 [INFO] subscription-manager:28211:MainThread @managercli.py:364 - Consumer Identity name=dhcp70-150.rhts.eng.bos.redhat.com uuid=d6d038a3-a0f7-4791-9269-894c53d899b2
2016-12-12 05:13:45,850 [INFO] subscription-manager:28211:MainThread @connection.py:525 - Response: status=200, requestUuid=0b1f185c-8bde-46a5-82f1-b28bc455853d, request="GET /subscription/consumers/d6d038a3-a0f7-4791-9269-894c53d899b2"
2016-12-12 05:13:46,466 [INFO] subscription-manager:28211:MainThread @connection.py:525 - Response: status=200, requestUuid=435b159f-742c-48e0-96d2-8e460977e7e2, request="GET /subscription/"

Marking as verified!!

Comment 8 errata-xmlrpc 2017-03-21 10:57:29 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