Project

Profile

Help

Story #1032

closed

Allow plain hostname as config.proxy_url in downloaders

Added by mkovacik@redhat.com almost 9 years ago. Updated about 5 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Platform Release:
Target Release - Nectar:
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

Having specified plain hostname as config.proxy_url, following traceback can be seen in the logs:

[root@ip-172-31-24-137 ~]# less /var/log/messages

Jun  4 16:01:17 ip-172-31-24-137 pulp: celery.worker.job:INFO: Task pulp.server.async.tasks._queue_reserved_task[0d4463ad-52a0-4591-b988-4a7e5d69d540] succeeded in 0.0369634300005s: None
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-96928)     _add_proxy(session, config)
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-96928)   File "/usr/lib/python2.6/site-packages/nectar/downloaders/threaded.py", line 342, in _add_proxy
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-96928)     url = ':'.join((host, str(config.proxy_port)))
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-96928) TypeError: sequence item 0: expected string, NoneType found
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-95072) Unhandled Exception in Worker Thread [140192698595072]
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-95072) Traceback (most recent call last):
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-95072)   File "/usr/lib/python2.6/site-packages/nectar/downloaders/threaded.py", line 92, in worker
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-95072)     session = build_session(self.config)
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-95072)   File "/usr/lib/python2.6/site-packages/nectar/downloaders/threaded.py", line 311, in build_session
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-95072)     _add_proxy(session, config)
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-95072)   File "/usr/lib/python2.6/site-packages/nectar/downloaders/threaded.py", line 342, in _add_proxy
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-95072)     url = ':'.join((host, str(config.proxy_port)))
Jun  4 16:01:17 ip-172-31-24-137 pulp: nectar.downloaders.threaded:ERROR: (1999-95072) TypeError: sequence item 0: expected string, NoneType found
Jun  4 16:03:44 ip-172-31-24-137 pulp: celery.worker.control:INFO: Terminating 97b36355-e665-4b47-b998-fed15e1d9f5c (15)

Since particular download session proxy URLs are assembled from the proxy_url, proxy_port, proxy_username and proxy_password attributes, I suggest following semantics to maintain current API and address the issue,
in case plain hostname (no protocol) was specified as config.proxy_url:

  • session['proxies']['http'] = 'http://' + <hostname>
  • session['proxies']['https'] = 'https://' + <hostname>

Version:
python-nectar-1.3.1-2.el6.noarch

Reproducer steps:
[root@ip-172-31-24-137 ~]# pulp-admin -u admin -p admin rpm repo create --repo-id zoo --feed https://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/ --proxy-host squid.example.com --proxy-port 3128 --proxy-user squid --proxy-pass squid
[root@ip-172-31-24-137 ~]# pulp-admin -u admin -p admin rpm repo sync run --repo-id zoo


Files

threaded.py.patch (1.23 KB) threaded.py.patch mkovacik@redhat.com, 06/04/2015 11:23 PM

Also available in: Atom PDF