Bug 1546351

Summary: A RHEL-7.5 client host cannot rhnreg_ks to a Satellite 5 server through a proxy
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: pythonAssignee: Tomas Orsava <torsava>
Status: CLOSED ERRATA QA Contact: Mirek Długosz <mzalewsk>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: adujicek, ggainey, herrold, hhorak, jhutar, jkejda, jsefler, khowell, lmiksik, mmraka, mzalewsk, psegedy, pviktori, python-maint, rjerrido, tkasparek, tlestach, torsava
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-2.7.5-67 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 15:00:08 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 John Sefler 2018-02-16 20:49:00 UTC
Description of problem:

The recent change in python-libs-2.7.5-66 to address bug 1483438 has broke rhnreg_ks ability to register to a Satellite 5 server through a proxy.

Note...
The following package combination from compose RHEL-7.5-Snapshot-3.1 was not a problem.
   python-libs-2.7.5-65.el7.x86_64.rpm  
   rhnlib-2.5.65-7.el7.noarch.rpm  

The following package combination from compose RHEL-7.5-Snapshot-4.0 causes the traceback seen in the reproducer steps below. 
   python-libs-2.7.5-66.el7.x86_64.rpm  
   rhnlib-2.5.65-7.el7.noarch.rpm  



Version-Release number of selected component (if applicable):
[root@hp-dl380pgen8-02-vm-2 ~]# rpm -q python-libs
python-libs-2.7.5-66.el7.x86_64
[root@hp-dl380pgen8-02-vm-2 ~]# 
[root@hp-dl380pgen8-02-vm-2 ~]# rpm -q --changelog python-libs | grep 2.7.5-66 -A2
* Fri Feb 09 2018 Charalampos Stratakis <cstratak> - 2.7.5-66
- Fix https connections behind a proxy.
Resolves: rhbz#1483438
[root@hp-dl380pgen8-02-vm-2 ~]# rpm -q --whatprovides /usr/lib/python2.7/site-packages/rhn/connections.py
rhnlib-2.5.65-7.el7.noarch
[root@hp-dl380pgen8-02-vm-2 ~]# rpm -q --whatprovides `which rhnreg_ks`
rhn-setup-2.0.2-21.el7.noarch


How reproducible:


Steps to Reproduce:
Configure /etc/sysconfig/rhn/up2date to use a valid proxy server when registering to a valid Sat5 server  (steps not shown)

[root@hp-dl380pgen8-02-vm-2 ~]# rhnreg_ks --serverUrl=https://rhsm-sat5.usersys.redhat.com/XMLRPC --username=rhsm-client --password=REDACTED --profilename=rhsm-automation.hp-dl380pgen8-02-vm-2.lab.bos.redhat.com --force --norhnsd --nohardware --nopackages --novirtinfo
An error has occurred:
<type 'exceptions.AttributeError'>
See /var/log/up2date for more information
[root@hp-dl380pgen8-02-vm-2 ~]# 
[root@hp-dl380pgen8-02-vm-2 ~]# tail -f /var/log/up2date
[Fri Feb 16 15:33:39 2018] up2date 
Traceback (most recent call last):
  File "/usr/sbin/rhnreg_ks", line 218, in <module>
    cli.run()
  File "/usr/share/rhn/up2date_client/rhncli.py", line 96, in run
    sys.exit(self.main() or 0)
  File "/usr/sbin/rhnreg_ks", line 90, in main
    rhnreg.getCaps()
  File "/usr/share/rhn/up2date_client/rhnreg.py", line 248, in getCaps
    s.capabilities.validate()
  File "/usr/share/rhn/up2date_client/rhnserver.py", line 63, in __call__
    return rpcServer.doCall(method, *args, **kwargs)
  File "/usr/share/rhn/up2date_client/rpcServer.py", line 204, in doCall
    ret = method(*args, **kwargs)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1233, in __call__
    return self.__send(self.__name, args)
  File "/usr/share/rhn/up2date_client/rpcServer.py", line 38, in _request1
    ret = self._request(methodname, params)
  File "/usr/lib/python2.7/site-packages/rhn/rpclib.py", line 384, in _request
    self._handler, request, verbose=self._verbose)
  File "/usr/lib/python2.7/site-packages/rhn/transports.py", line 147, in request
    connection = self.get_connection(host)
  File "/usr/lib/python2.7/site-packages/rhn/transports.py", line 327, in get_connection
    trusted_certs=self.trusted_certs)
  File "/usr/lib/python2.7/site-packages/rhn/connections.py", line 202, in __init__
    password, timeout=timeout)
  File "/usr/lib/python2.7/site-packages/rhn/connections.py", line 120, in __init__
    self._set_hostport(host, port)
<type 'exceptions.AttributeError'>: HTTPSProxyConnection instance has no attribute '_set_hostport'


Actual results:
  above

Expected results:
  successful registration using a valid proxy

Additional info:

Patch https://bugzilla.redhat.com/attachment.cgi?id=1392607 from bug 1483438 appears to have removed '_set_hostport' thereby breaking client tools like rhnreg_ks.

Comment 2 Tomas Lestach 2018-02-19 10:01:43 UTC
John, thank you for letting us know. Adding more people to CC of this BZ.

Is it possible to keep _set_hostport() available for compatibility reasons? It can be simplified, but it shouldn't be removed. I feel such interface shouldn't change between RHEL minor versions, as there may be many tools relying on that, like e.g. the registration piece for Satellite 5.

Comment 3 Petr Viktorin (pviktori) 2018-02-19 12:04:00 UTC
We'll see if it can be re-added.

In the future, use of private APIs should really be coordinated with maintainers, so a proper API can be added for the use case.

Comment 5 Tomas Orsava 2018-02-19 15:22:56 UTC
I patched Python to bring the old private API back, so _set_hostport() should work once again.

Build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15336311
x86_64: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15336313

Could I ask you, John, to test if this fixes your issue or help me setup a system so I can reproduce and test myself?

IMPORTANT: If we want to get this into RHEL 7.5, the deadline is this Wednesday.

Comment 9 Mirek Długosz 2018-02-23 14:41:21 UTC
Changing status to VERIFIED based on John's comment.

Comment 12 errata-xmlrpc 2018-04-10 15:00:08 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://access.redhat.com/errata/RHBA-2018:0833