Show More
@@ -20,7 +20,7 b' import os' | |||||
20 | import time |
|
20 | import time | |
21 | import logging |
|
21 | import logging | |
22 |
|
22 | |||
23 | from rhodecode.lib.config_utils import get_config |
|
23 | from rhodecode.lib.config_utils import get_app_config_lightweight | |
24 |
|
24 | |||
25 | from rhodecode.lib.svn_txn_utils import get_txn_id_from_store |
|
25 | from rhodecode.lib.svn_txn_utils import get_txn_id_from_store | |
26 |
|
26 | |||
@@ -68,7 +68,12 b' def prepare_callback_daemon(extras, prot' | |||||
68 | txn_id=txn_id, host=host, port=port) |
|
68 | txn_id=txn_id, host=host, port=port) | |
69 | case 'celery': |
|
69 | case 'celery': | |
70 | from rhodecode.lib.hook_daemon.celery_hooks_deamon import CeleryHooksCallbackDaemon |
|
70 | from rhodecode.lib.hook_daemon.celery_hooks_deamon import CeleryHooksCallbackDaemon | |
71 | callback_daemon = CeleryHooksCallbackDaemon(get_config(extras['config'])) |
|
71 | ||
|
72 | config = get_app_config_lightweight(extras['config']) | |||
|
73 | task_queue = config.get('celery.broker_url') | |||
|
74 | task_backend = config.get('celery.result_backend') | |||
|
75 | ||||
|
76 | callback_daemon = CeleryHooksCallbackDaemon(task_queue, task_backend) | |||
72 | case 'local': |
|
77 | case 'local': | |
73 | from rhodecode.lib.hook_daemon.hook_module import Hooks |
|
78 | from rhodecode.lib.hook_daemon.hook_module import Hooks | |
74 | callback_daemon = HooksModuleCallbackDaemon(Hooks.__module__) |
|
79 | callback_daemon = HooksModuleCallbackDaemon(Hooks.__module__) |
@@ -24,10 +24,12 b' class CeleryHooksCallbackDaemon(BaseHook' | |||||
24 | Context manger for achieving a compatibility with celery backend |
|
24 | Context manger for achieving a compatibility with celery backend | |
25 | """ |
|
25 | """ | |
26 |
|
26 | |||
27 |
def __init__(self, |
|
27 | def __init__(self, task_queue, task_backend): | |
28 | # TODO: replace this with settings bootstrapped... |
|
28 | self.task_queue = task_queue | |
29 | self.task_queue = config.get('app:main', 'celery.broker_url') |
|
29 | self.task_backend = task_backend | |
30 | self.task_backend = config.get('app:main', 'celery.result_backend') |
|
|||
31 |
|
30 | |||
32 | def __repr__(self): |
|
31 | def __repr__(self): | |
33 | return f'CeleryHooksCallbackDaemon(task_queue={self.task_queue}, task_backend={self.task_backend})' |
|
32 | return f'CeleryHooksCallbackDaemon(task_queue={self.task_queue}, task_backend={self.task_backend})' | |
|
33 | ||||
|
34 | def __repr__(self): | |||
|
35 | return f'CeleryHooksCallbackDaemon(task_queue={self.task_queue}, task_backend={self.task_backend})' |
@@ -177,7 +177,7 b' def baseapp(ini_config, vcsserver, http_' | |||||
177 | from rhodecode.lib.config_utils import get_app_config |
|
177 | from rhodecode.lib.config_utils import get_app_config | |
178 | from rhodecode.config.middleware import make_pyramid_app |
|
178 | from rhodecode.config.middleware import make_pyramid_app | |
179 |
|
179 | |||
180 |
log.info("Using the RhodeCode configuration: |
|
180 | log.info("Using the RhodeCode configuration:%s", ini_config) | |
181 | pyramid.paster.setup_logging(ini_config) |
|
181 | pyramid.paster.setup_logging(ini_config) | |
182 |
|
182 | |||
183 | settings = get_app_config(ini_config) |
|
183 | settings = get_app_config(ini_config) |
@@ -322,6 +322,7 b' class TestPrepareHooksDaemon(object):' | |||||
322 | 'invalid', |
|
322 | 'invalid', | |
323 | 'Http', |
|
323 | 'Http', | |
324 | 'HTTP', |
|
324 | 'HTTP', | |
|
325 | 'celerY' | |||
325 | )) |
|
326 | )) | |
326 | def test_raises_on_invalid_protocol(self, protocol): |
|
327 | def test_raises_on_invalid_protocol(self, protocol): | |
327 | expected_extras = { |
|
328 | expected_extras = { |
@@ -567,10 +567,11 b' def test_merge_response_message(mr_type,' | |||||
567 |
|
567 | |||
568 |
|
568 | |||
569 | @pytest.fixture() |
|
569 | @pytest.fixture() | |
570 | def merge_extras(user_regular): |
|
570 | def merge_extras(request, user_regular): | |
571 | """ |
|
571 | """ | |
572 | Context for the vcs operation when running a merge. |
|
572 | Context for the vcs operation when running a merge. | |
573 | """ |
|
573 | """ | |
|
574 | ||||
574 | extras = { |
|
575 | extras = { | |
575 | 'ip': '127.0.0.1', |
|
576 | 'ip': '127.0.0.1', | |
576 | 'username': user_regular.username, |
|
577 | 'username': user_regular.username, | |
@@ -578,7 +579,7 b' def merge_extras(user_regular):' | |||||
578 | 'action': 'push', |
|
579 | 'action': 'push', | |
579 | 'repository': 'fake_target_repo_name', |
|
580 | 'repository': 'fake_target_repo_name', | |
580 | 'scm': 'git', |
|
581 | 'scm': 'git', | |
581 | 'config': 'fake_config_ini_path', |
|
582 | 'config': request.config.getini('pyramid_config'), | |
582 | 'repo_store': '', |
|
583 | 'repo_store': '', | |
583 | 'make_lock': None, |
|
584 | 'make_lock': None, | |
584 | 'locked_by': [None, None, None], |
|
585 | 'locked_by': [None, None, None], |
General Comments 0
You need to be logged in to leave comments.
Login now