Changeset - 47631be9f449
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2013-03-25 22:51:06
marcin@python-works.com
fix GIT env extraction
2 files changed with 6 insertions and 5 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/hooks.py
Show inline comments
 
@@ -315,13 +315,13 @@ def handle_git_receive(repo_path, revs, 
 
    from paste.deploy import appconfig
 
    from sqlalchemy import engine_from_config
 
    from rhodecode.config.environment import load_environment
 
    from rhodecode.model import init_model
 
    from rhodecode.model.db import RhodeCodeUi
 
    from rhodecode.lib.utils import make_ui
 
    extras = json.loads(env['RHODECODE_EXTRAS'])
 
    extras = _extract_extras(env)
 

	
 
    path, ini_name = os.path.split(extras['config'])
 
    conf = appconfig('config:%s' % ini_name, relative_to=path)
 
    load_environment(conf.global_conf, conf.local_conf)
 

	
 
    engine = engine_from_config(conf, 'sqlalchemy.db1.')
 
@@ -336,14 +336,12 @@ def handle_git_receive(repo_path, revs, 
 
    if not repo:
 
        raise OSError('Repository %s not found in database'
 
                      % (safe_str(repo_path)))
 

	
 
    _hooks = dict(baseui.configitems('hooks')) or {}
 

	
 
    for k, v in extras.items():
 
        baseui.setconfig('rhodecode_extras', k, v)
 
    if hook_type == 'pre':
 
        repo = repo.scm_instance
 
    else:
 
        #post push shouldn't use the cached instance never
 
        repo = repo.scm_instance_no_cache()
 

	
rhodecode/lib/utils2.py
Show inline comments
 
@@ -580,19 +580,22 @@ def obfuscate_url_pw(engine):
 

	
 
def get_server_url(environ):
 
    req = webob.Request(environ)
 
    return req.host_url + req.script_name
 

	
 

	
 
def _extract_extras():
 
def _extract_extras(env=None):
 
    """
 
    Extracts the rc extras data from os.environ, and wraps it into named
 
    AttributeDict object
 
    """
 
    if not env:
 
        env = os.environ
 

	
 
    try:
 
        rc_extras = json.loads(os.environ['RC_SCM_DATA'])
 
        rc_extras = json.loads(env['RC_SCM_DATA'])
 
    except:
 
        print os.environ
 
        print >> sys.stderr, traceback.format_exc()
 
        rc_extras = {}
 

	
 
    try:
0 comments (0 inline, 0 general)