vcs: Do not pass the backend key into the scm app instances.
We used the key as a value for a response header. Since this header is removed there is no need to pass the backend key araound.
This commit is contained in:
parent
c6466346b4
commit
ecc24326d7
9 changed files with 18 additions and 24 deletions
|
|
@ -77,7 +77,7 @@ class SimpleGit(simplevcs.SimpleVCS):
|
|||
|
||||
def _create_wsgi_app(self, repo_path, repo_name, config):
|
||||
return self.scm_app.create_git_wsgi_app(
|
||||
repo_path, repo_name, config, self.SCM)
|
||||
repo_path, repo_name, config)
|
||||
|
||||
def _create_config(self, extras, repo_name):
|
||||
extras['git_update_server_info'] = utils2.str2bool(
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class SimpleHg(simplevcs.SimpleVCS):
|
|||
|
||||
def _create_wsgi_app(self, repo_path, repo_name, config):
|
||||
return self.scm_app.create_hg_wsgi_app(
|
||||
repo_path, repo_name, config, self.SCM)
|
||||
repo_path, repo_name, config)
|
||||
|
||||
def _create_config(self, extras, repo_name):
|
||||
config = utils.make_db_config(repo=repo_name)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ HG_REMOTE_WSGI = None
|
|||
GIT_REMOTE_WSGI = None
|
||||
|
||||
|
||||
def create_git_wsgi_app(repo_path, repo_name, config, backend):
|
||||
def create_git_wsgi_app(repo_path, repo_name, config):
|
||||
"""
|
||||
Return a WSGI app backed by a remote app to handle Git.
|
||||
|
||||
|
|
@ -45,10 +45,10 @@ def create_git_wsgi_app(repo_path, repo_name, config, backend):
|
|||
log.error('Pyro server has not been initialized yet')
|
||||
|
||||
return wsgi_app_caller_client.RemoteAppCaller(
|
||||
factory, backend, repo_path, repo_name, config)
|
||||
factory, repo_path, repo_name, config)
|
||||
|
||||
|
||||
def create_hg_wsgi_app(repo_path, repo_name, config, backend):
|
||||
def create_hg_wsgi_app(repo_path, repo_name, config):
|
||||
"""
|
||||
Return a WSGI app backed by a remote app to handle Mercurial.
|
||||
|
||||
|
|
@ -60,4 +60,4 @@ def create_hg_wsgi_app(repo_path, repo_name, config, backend):
|
|||
log.error('Pyro server has not been initialized yet')
|
||||
|
||||
return wsgi_app_caller_client.RemoteAppCaller(
|
||||
factory, backend, repo_path, repo_name, config)
|
||||
factory, repo_path, repo_name, config)
|
||||
|
|
|
|||
|
|
@ -37,14 +37,14 @@ import rhodecode
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def create_git_wsgi_app(repo_path, repo_name, config, backend):
|
||||
def create_git_wsgi_app(repo_path, repo_name, config):
|
||||
url = _vcs_streaming_url() + 'git/'
|
||||
return VcsHttpProxy(url, repo_path, repo_name, config, backend)
|
||||
return VcsHttpProxy(url, repo_path, repo_name, config)
|
||||
|
||||
|
||||
def create_hg_wsgi_app(repo_path, repo_name, config, backend):
|
||||
def create_hg_wsgi_app(repo_path, repo_name, config):
|
||||
url = _vcs_streaming_url() + 'hg/'
|
||||
return VcsHttpProxy(url, repo_path, repo_name, config, backend)
|
||||
return VcsHttpProxy(url, repo_path, repo_name, config)
|
||||
|
||||
|
||||
def _vcs_streaming_url():
|
||||
|
|
@ -67,7 +67,7 @@ class VcsHttpProxy(object):
|
|||
server as well.
|
||||
"""
|
||||
|
||||
def __init__(self, url, repo_path, repo_name, config, backend):
|
||||
def __init__(self, url, repo_path, repo_name, config):
|
||||
"""
|
||||
:param str url: The URL of the VCSServer to call.
|
||||
"""
|
||||
|
|
@ -75,7 +75,6 @@ class VcsHttpProxy(object):
|
|||
self._repo_name = repo_name
|
||||
self._repo_path = repo_path
|
||||
self._config = config
|
||||
self._backend = backend
|
||||
log.debug(
|
||||
"Creating VcsHttpProxy for repo %s, url %s",
|
||||
repo_name, url)
|
||||
|
|
|
|||
|
|
@ -56,18 +56,16 @@ class RemoteAppCaller(object):
|
|||
It first cleans the environment, so as to reduce the data transferred.
|
||||
"""
|
||||
|
||||
def __init__(self, remote_wsgi, backend, *args, **kwargs):
|
||||
def __init__(self, remote_wsgi, *args, **kwargs):
|
||||
"""
|
||||
:param remote_wsgi: The remote wsgi object that creates a
|
||||
WSGIAppCaller. This object
|
||||
has to have a handle method, with the signature:
|
||||
handle(environ, start_response, *args, **kwargs)
|
||||
:param backend: Key (str) of the SCM backend that is in use.
|
||||
:param args: args to be passed to the app creation
|
||||
:param kwargs: kwargs to be passed to the app creation
|
||||
"""
|
||||
self._remote_wsgi = remote_wsgi
|
||||
self._backend = backend
|
||||
self._args = args
|
||||
self._kwargs = kwargs
|
||||
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ for testing purposes.
|
|||
import mock
|
||||
|
||||
|
||||
def create_git_wsgi_app(repo_path, repo_name, config, backend):
|
||||
def create_git_wsgi_app(repo_path, repo_name, config):
|
||||
return mock_git_wsgi
|
||||
|
||||
|
||||
def create_hg_wsgi_app(repo_path, repo_name, config, backend):
|
||||
def create_hg_wsgi_app(repo_path, repo_name, config):
|
||||
return mock_hg_wsgi
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import pytest
|
|||
import webtest
|
||||
|
||||
from rhodecode.lib.middleware.utils import scm_app_http, scm_app
|
||||
from rhodecode.lib.middleware.simplegit import SimpleGit
|
||||
from rhodecode.lib.vcs.conf import settings
|
||||
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ def vcs_http_app(vcsserver_http_echo_app):
|
|||
"""
|
||||
git_url = vcsserver_http_echo_app.http_url + 'stream/git/'
|
||||
vcs_http_proxy = scm_app_http.VcsHttpProxy(
|
||||
git_url, 'stub_path', 'stub_name', None, 'stub_backend')
|
||||
git_url, 'stub_path', 'stub_name', None)
|
||||
app = webtest.TestApp(vcs_http_proxy)
|
||||
return app
|
||||
|
||||
|
|
@ -112,7 +111,7 @@ def vcs_pyro4_app(vcsserver_pyro_echo_app):
|
|||
with mock.patch('rhodecode.lib.middleware.utils.scm_app.GIT_REMOTE_WSGI',
|
||||
GIT_REMOTE_WSGI):
|
||||
pyro4_app = scm_app.create_git_wsgi_app(
|
||||
'stub_path', 'stub_name', stub_config, SimpleGit.SCM)
|
||||
'stub_path', 'stub_name', stub_config)
|
||||
app = webtest.TestApp(pyro4_app)
|
||||
return app
|
||||
|
||||
|
|
|
|||
|
|
@ -133,4 +133,4 @@ def create_scm_app():
|
|||
"""
|
||||
echo_app_url = os.environ["RC_ECHO_URL"]
|
||||
return scm_app_http.VcsHttpProxy(
|
||||
echo_app_url, 'stub_path', 'stub_name', None, 'stub_backend')
|
||||
echo_app_url, 'stub_path', 'stub_name', None)
|
||||
|
|
|
|||
|
|
@ -86,8 +86,7 @@ def test_remote_app_caller():
|
|||
return (['content'], '200 OK', [('Content-Type', 'text/plain')])
|
||||
|
||||
wrapper_app = wsgi_app_caller_client.RemoteAppCaller(
|
||||
RemoteAppCallerMock(), 'dummy-backend',
|
||||
'a1', 'a2', arg3='a3', arg4='a4')
|
||||
RemoteAppCallerMock(), 'a1', 'a2', arg3='a3', arg4='a4')
|
||||
|
||||
test_app = webtest.TestApp(wrapper_app)
|
||||
|
||||
|
|
@ -95,7 +94,6 @@ def test_remote_app_caller():
|
|||
|
||||
assert response.status == '200 OK'
|
||||
assert sorted(response.headers.items()) == sorted([
|
||||
('X-RhodeCode-Backend', 'dummy-backend'),
|
||||
('Content-Type', 'text/plain'),
|
||||
('Content-Length', '7'),
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue