Version:
changeset: 257:acf0db041e3c
tag: tip
user: holger krekel [email protected]
date: Sun Aug 04 21:22:58 2013 +0200
summary: fix LICENSE to MIT (BSD was an accident)
while investigating issue #20, I realize that it is possible to specify a non valid index name leading to an exception on the server side.
here is the structure of my test index at the start:
#!bash
$ devpi getjson http://localhost:3141
{
"result": {
"emilie": {
"email": "[email protected]",
"indexes": {
"dev": {
"acl_upload": [],
"bases": [
"/root/dev"
],
"type": "stage",
"uploadtrigger_jenkins": null,
"volatile": true
}
},
"username": "emilie"
},
"root": {
"indexes": {
"dev": {
"acl_upload": [],
"bases": [
"root/pypi"
],
"type": "stage",
"uploadtrigger_jenkins": null,
"volatile": true
},
"pypi": {
"acl_upload": [],
"bases": [],
"type": "mirror",
"uploadtrigger_jenkins": null,
"volatile": false
}
},
"username": "root"
}
},
"status": 200,
"type": "list:userconfig"
}
I then modify the base with a invalid index name (eggplant) and the devpi server accepts the request.
#!bash
$ devpi index --modify /emilie/prod bases=/root/eggplant
200: OK
$ devpi getjson http://localhost:3141
{
"result": {
"emilie": {
"email": "[email protected]",
"indexes": {
"dev": {
"acl_upload": [],
"bases": [
"/root/eggplant"
],
"type": "stage",
"uploadtrigger_jenkins": null,
"volatile": true
}
},
"username": "emilie"
},
"root": {
"indexes": {
"dev": {
"acl_upload": [],
"bases": [
"root/pypi"
],
"type": "stage",
"uploadtrigger_jenkins": null,
"volatile": true
},
"pypi": {
"acl_upload": [],
"bases": [],
"type": "mirror",
"uploadtrigger_jenkins": null,
"volatile": false
}
},
"username": "root"
}
},
"status": 200,
"type": "list:userconfig"
}
When attempting to install a package (residing on PyPi), I get the following on the server side.
#!python
localhost - - [05/Aug/2013 16:21:56] "GET /emilie/dev/+simple/ HTTP/1.1" 500 59
AAAA emilie dev
AAAA /root/eggplant None
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/lpbrac/bitbucket/devpi_doc_contrib/lib/python2.7/site-packages/bottle-0.11.6-py2.7.egg/EGG-INFO/scripts/bottle.py", line 874, in __call__
return self.wsgi(environ, start_response)
File "/home/lpbrac/bitbucket/devpi_doc_contrib/lib/python2.7/site-packages/bottle-0.11.6-py2.7.egg/EGG-INFO/scripts/bottle.py", line 849, in wsgi
out = self._cast(self._handle(environ))
File "/home/lpbrac/bitbucket/devpi_doc_contrib/lib/python2.7/site-packages/bottle-0.11.6-py2.7.egg/EGG-INFO/scripts/bottle.py", line 764, in _handle
return route.call(**args)
File "/home/lpbrac/bitbucket/devpi_doc_contrib/lib/python2.7/site-packages/bottle-0.11.6-py2.7.egg/EGG-INFO/scripts/bottle.py", line 1575, in wrapper
rv = callback(*a, **ka)
File "/home/lpbrac/bitbucket/devpi_doc_contrib/server/devpi_server/views.py", line 175, in simple_list_project
result = stage.getreleaselinks(projectname)
File "/home/lpbrac/bitbucket/devpi_doc_contrib/server/devpi_server/db.py", line 291, in getreleaselinks
projectname=projectname):
File "/home/lpbrac/bitbucket/devpi_doc_contrib/server/devpi_server/db.py", line 194, in op_with_bases
stage = self.db.getstage(base)
File "/home/lpbrac/bitbucket/devpi_doc_contrib/server/devpi_server/db.py", line 140, in getstage
user, index = user.split("/")
ValueError: too many values to unpack
The problem here is the initial '/' in /root/eggplant. If we work around this issue in the code, the invalid index results in an ixconfig set to None causing DB.op_with_base to fail with
note When fixing the issue of initial /, we actually resolve issue #20 allowing to install a pypi package via a user index.
#!python
File "/home/lpbrac/bitbucket/devpi_doc_contrib/server/devpi_server/db.py", line 198, in op_with_bases
base_entries = getattr(stage, opname)(**kw)
AttributeError: 'NoneType' object has no attribute 'getreleaselinks'
Note: when specifying the correct index