Bug 1298327 - Status Cache not used when listing repos with a bad proxy
Status Cache not used when listing repos with a bad proxy
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.8
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Chris Snyder
Jan Stavel
:
Depends On:
Blocks: 1176219 1306005
  Show dependency treegraph
 
Reported: 2016-01-13 14:12 EST by Chris Snyder
Modified: 2016-06-08 13:35 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:39:05 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)

  None (edit)
Description Chris Snyder 2016-01-13 14:12:03 EST
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 09:43:35 EST
In master as of the commit below:

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

    1298327: Handles exception in repolib
Comment 3 Jan Stavel 2016-02-08 14:20:41 EST
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 15:16:08 EST
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 16:39:05 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.