Issue #3578
closed
pulp-python wrong path to pypi
Status:
CLOSED - CURRENTRELEASE
Description
When creating a repo like this
pulp-admin python repo create --repo-id pypitest --feed https://pypi.org/ --package-names CouchDB --proxy-host http://22.0.53.8 --proxy-port 3128
And syncing
pulp-admin python repo sync run --repo-id pypitest
pulp try to download the metadata from https://pypi.org/pypi/CouchDB/json/
but this is 404, it should be https://pypi.org/pypi/CouchDB/json (without the / at the end)
After removing the trailing slash in /usr/lib/python2.7/site-packages/pulp_python/plugins/importers/sync.py, it's working fine.
pulp-python-plugins-2.0.2-1.el7.noarch
Best regards,
- Status changed from NEW to POST
- Assignee set to bizhang
Thanks for filing this Poil! This is caused by the recent pypi migration to warehouse- the new json api thinks that a trailing slash means that it should redirect.
I've opened a PR for this issue: https://github.com/pulp/pulp_python/pull/144
and we'll get the fix out in the new version.
For future reference we really appreciate PRs for easy fixes like these and are willing to bribe potential contributors with pulp stickers :)
It seems there are another changes, in the json file
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: pulp_python.plugins.importers.sync:INFO: Processing metadata retrieved from https://pypi.org/pypi/CouchDB/json.
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) 'path'
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) Traceback (most recent call last):
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) File "/usr/lib/python2.7/site-packages/nectar/downloaders/base.py", line 145, in _fire_event_to_listener
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) event_listener_callback(*args, **kwargs)
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) File "/usr/lib/python2.7/site-packages/pulp_python/plugins/importers/sync.py", line 65, in download_succeeded
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) units = models.Package.objects.from_metadata(destination.read())
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) File "/usr/lib/python2.7/site-packages/pulp_python/plugins/querysets.py", line 55, in from_metadata
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) units.append(self._document.from_json(package, version, metadata['info']))
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) File "/usr/lib/python2.7/site-packages/pulp_python/plugins/models.py", line 115, in from_json
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) package_attrs['path'] = package_data['path']
avril 19 09:25:38 tlspxe-p01.engsec pulp[1598]: nectar.downloaders.base:ERROR: (1598-21376) KeyError: 'path'
https://github.com/pulp/pulp_python/pull/145/files
I've got another bug, I don't think it comes from my fix :
pip install -i pulp.repo trusted-host pulp.repo CouchDB
Is trying to download "/pulp/python/web/ghostdev/simple/couchdb/" but pulp mirrored it to http://pulp.repo/pulp/python/web/ghostdev/simple/CouchDB/
From PEP 503 it seems that it must be lowercases : https://www.python.org/dev/peps/pep-0503/
From PEP 426 it seems that it must be lowercases : https://www.python.org/dev/peps/pep-0426/#source-url
edit By activating mod_speling I have a quick fix
cat /etc/httpd/conf.d/pulp_python.conf
#
# Apache configuration file for Pulp's Python support
#
# -- HTTPS Repositories ---------
Alias /pulp/python /var/www/pub/python/
<Directory /var/www/pub/python>
Options FollowSymLinks Indexes
DirectoryIndex index.html index.json
CheckCaseOnly on
CheckSpelling on
</Directory>
- Triaged changed from No to Yes
- Sprint set to Sprint 36
- Status changed from POST to MODIFIED
Hi,
Should I open another issue about PEP 503 and my quick fix via mod_speling ?
- Platform Release set to 2.16.4
- Status changed from MODIFIED to 5
- Status changed from 5 to CLOSED - CURRENTRELEASE
Also available in: Atom
PDF
Remove trailing slash from json api.
This is caused by the warehouse migrations- the json api works differently in warehousem and a trailing slash would cause it to be redirected to a different location.
fixes #3578 https://pulp.plan.io/issues/3578