Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip search fails if devpi-web is only installed on the replica #567

Closed
theMarix opened this issue Jul 27, 2018 · 1 comment
Closed

pip search fails if devpi-web is only installed on the replica #567

theMarix opened this issue Jul 27, 2018 · 1 comment

Comments

@theMarix
Copy link

I tried to get pip search working following the example given in the documentation. Doing so I ran into an issue with the way that our set-up works. Using a standalone Devpi as in the documentation pip search works as expected. The same is true in a replica set-up where devpi-web is installed on both, master and replica. However, in the following case it break:

  • Have a master that does not have devpi-web (installed via pip install devpi-server)
  • Have a replica that does have devpi-web (installed via pip install devpi-server devpi-web). In the example it listens on port 3142.

Now, pip search will fail:

$ pip search -i http://localhost:3142/root/pypi/ zypper
HTTP error 404 while getting http://localhost:3142/root/pypi/
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/search.py", line 45, in run
    pypi_hits = self.search(query, options)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/search.py", line 62, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 776, in request
    response.raise_for_status()
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/models.py", line 862, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: cannot submit to pypi mirror for url: http://localhost:3142/root/pypi/

Replica log shows the following:

Serving on http://localhost:3142
2018-07-27 16:55:39,104 INFO  [req0] POST /root/pypi/
2018-07-27 16:55:39,105 INFO  [req0] relaying: POST http://localhost:3141/root/pypi/
2018-07-27 16:55:39,115 INFO  [req0] FIN: relaying: POST http://localhost:3141/root/pypi/

Master log shows the following:

2018-07-27 16:55:39,110 INFO  [req1] POST /root/pypi/
2018-07-27 16:55:39,112 ERROR [req1] [Wtx1] while handling http://localhost:3141/root/pypi/:
cannot submit to pypi mirror

When attempting to access a non-mirrored index it fails, too. However, in this case Devpi seems to request authentication, as pip starts querying me for user credentials.

@fschulze
Copy link
Contributor

Good catch. The transaction/replica middle ware of devpi causes it. I have to think about how to fix that properly. Some kind of decorator or predicate on the views that need it, or the other way around to mark views that don't need it. I guess devpi-lockdown wouldn't work on a replica either, because it needs a POST for login.

fschulze added a commit to fschulze/devpi that referenced this issue Sep 29, 2019
fschulze added a commit to fschulze/devpi that referenced this issue Sep 29, 2019
fschulze added a commit that referenced this issue Sep 29, 2019
Fix #567: the ``pip search`` view is no longer proxied to the master.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants