Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1298327

Summary: Status Cache not used when listing repos with a bad proxy
Product: Red Hat Enterprise Linux 6 Reporter: Chris Snyder <csnyder>
Component: subscription-managerAssignee: Chris Snyder <csnyder>
Status: CLOSED ERRATA QA Contact: Jan Stavel <jstavel>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.8CC: jsefler, jstavel, skallesh
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-10 20:39:05 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:
Bug Depends On:    
Bug Blocks: 1176219, 1306005    

Description Chris Snyder 2016-01-13 19:12:03 UTC
Description of problem:
When attempting to reproduce bz 1176219 I discovered that the cache was no longer being used at all due to an unhandled exception in network communication that occurs before the silent usage of the status cache.

Version-Release number of selected component (if applicable):
subscription-manager-1.16.7-1

The change in behavior can first be seen at commit: d0953939bb88199ea0f33ef7eee2521766075d50

How reproducible:
100%

Steps to Reproduce:

1) Register without a proxy
2) `subscription-manager repos --list`
3) `subscription-manager repos --list --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=bad-username --proxypassword=bad-password`

Actual results:
"
Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information.
"
Expected results:

The behavior described in bz 1176219 (use the cache to finish command execution albeit silently)

Comment 1 Chris Snyder 2016-01-14 14:43:35 UTC
In master as of the commit below:

commit a544f6fce44d5bf1e7d7b740d7388baadd00d505
Author: Christopher Snyder <csnyder>
Date:   Thu Jan 14 00:01:04 2016 -0500

    1298327: Handles exception in repolib

Comment 3 Jan Stavel 2016-02-08 19:20:41 UTC
Red Hat Enterprise Linux Client release 6.7 (Santiago)
----------------------------
server type                      Red Hat Subscription Management
subscription management server   0.9.51.15-1
subscription management rules    5.15.1
subscription-manager             1.16.8-1.el6
python-rhsm                      1.16.6-1.el6
----------------------------     ----------------------------
Product                          68.pem
----------------------------     ----------------------------
Entitlement                      5795330892602082507.pem
----------------------------     ----------------------------


subscription-manager status
subscription-manager repos --list | grep "Repo ID" | wc -l
subscription-manager repos --list --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=redhat --proxypassword=badpasswd | grep "Repo ID" | wc -l

#+RESULTS:
: +-------------------------------------------+
:    System Status Details
: +-------------------------------------------+
: Overall Status: Current
: 
: 61
: 61

Comment 4 John Sefler 2016-02-08 20:16:08 UTC
Verifying version...
[root@jsefler-6 ~]# 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.8-1.el6
python-rhsm: 1.16.6-1.el6

[root@jsefler-6 ~]# subscription-manager register --serverurl=subscription.rhn.stage.redhat.com:443/subscription --autosubscribe
Registering to: subscription.rhn.stage.redhat.com:443/subscription
Username: stage_test_jsefler_9
Password: 
The system has been registered with ID: 982e2451-b746-43f3-9eea-0d40c8266c46 

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

[root@jsefler-6 ~]# subscription-manager repos --list | grep "Repo ID" | wc -l
76
[root@jsefler-6 ~]# 

NOTICE THAT THERE ARE 76 ENTITLED REPOS AVAILABLE FROM THE ATTACHED SUBSCRIPTION
NOW LET'S MAKE THE SAME CALL THROUGH A PROXY WITH INVALID CREDENTIALS...

[root@jsefler-6 ~]# subscription-manager repos --list --proxy=auto-services.usersys.redhat.com:3128 --proxyuser=baduser --proxypassword=badpasswd | grep "Repo ID" | wc -l
76
[root@jsefler-6 ~]# 

VERIFIED: THE COMMAND SUCCEEDS BY USING THE CACHED STATUS AS SHOWN BY THE TAIL OF THE rhsm.log BELOW "Unable to reach server, using cached status."...

[root@jsefler-6 ~]# tail -f /var/log/rhsm/rhsm.log
2016-02-08 15:09:06,996 [DEBUG] subscription-manager:6073 @connection.py:542 - Using proxy: auto-services.usersys.redhat.com:3128
2016-02-08 15:09:06,997 [DEBUG] subscription-manager:6073 @connection.py:557 - Making request: GET https://subscription.rhn.stage.redhat.com:443/subscription/
2016-02-08 15:09:07,063 [ERROR] subscription-manager:6073 @repolib.py:222 - Proxy connection failed: 407
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/repolib.py", line 219, in __init__
    self.override_supported = bool(self.identity.is_valid() and self.uep and self.uep.supports_resource('content_overrides'))
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 841, in supports_resource
    self._load_supported_resources()
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 828, in _load_supported_resources
    resources_list = self.conn.request_get("/")
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 681, in request_get
    return self._request("GET", method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 571, in _request
    conn.request(request_type, handler, body=body, headers=headers)
  File "/usr/lib64/python2.6/httplib.py", line 936, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.6/httplib.py", line 973, in _send_request
    self.endheaders()
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 273, in endheaders
    httpslib.HTTPSConnection.endheaders(self)
  File "/usr/lib64/python2.6/httplib.py", line 930, in endheaders
    self._send_output()
  File "/usr/lib64/python2.6/httplib.py", line 802, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.6/httplib.py", line 761, in send
    self.connect()
  File "/usr/lib64/python2.6/site-packages/M2Crypto/httpslib.py", line 203, in connect
    raise socket.error, "Proxy connection failed: %d" % code
error: Proxy connection failed: 407
2016-02-08 15:09:07,065 [DEBUG] subscription-manager:6073 @__init__.py:85 - Searching for content of type: yum
2016-02-08 15:09:07,068 [DEBUG] subscription-manager:6073 @connection.py:509 - 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
2016-02-08 15:09:07,068 [DEBUG] subscription-manager:6073 @connection.py:542 - Using proxy: auto-services.usersys.redhat.com:3128
2016-02-08 15:09:07,068 [DEBUG] subscription-manager:6073 @connection.py:557 - Making request: GET https://subscription.rhn.stage.redhat.com:443/subscription/consumers/982e2451-b746-43f3-9eea-0d40c8266c46/release
2016-02-08 15:09:07,134 [ERROR] subscription-manager:6073 @cache.py:229 - Proxy connection failed: 407
2016-02-08 15:09:07,134 [WARNING] subscription-manager:6073 @cache.py:235 - Unable to reach server, using cached status.


Despite this verification, bug 1176219 is still applicable.

Comment 6 errata-xmlrpc 2016-05-10 20:39:05 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/RHBA-2016-0797.html