Show More
@@ -587,6 +587,8 b' svn.proxy.generate_config = false' | |||
|
587 | 587 | svn.proxy.list_parent_path = true |
|
588 | 588 | ## Set location and file name of generated config file. |
|
589 | 589 | svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf |
|
590 | ## alternative mod_dav config template. This needs to be a mako template | |
|
591 | #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako | |
|
590 | 592 | ## Used as a prefix to the `Location` block in the generated config file. |
|
591 | 593 | ## In most cases it should be set to `/`. |
|
592 | 594 | svn.proxy.location_root = / |
@@ -556,6 +556,8 b' svn.proxy.generate_config = false' | |||
|
556 | 556 | svn.proxy.list_parent_path = true |
|
557 | 557 | ## Set location and file name of generated config file. |
|
558 | 558 | svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf |
|
559 | ## alternative mod_dav config template. This needs to be a mako template | |
|
560 | #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako | |
|
559 | 561 | ## Used as a prefix to the `Location` block in the generated config file. |
|
560 | 562 | ## In most cases it should be set to `/`. |
|
561 | 563 | svn.proxy.location_root = / |
@@ -66,6 +66,7 b' def _sanitize_settings_and_apply_default' | |||
|
66 | 66 | _string_setting(settings, config_keys.config_file_path, '', lower=False) |
|
67 | 67 | _string_setting(settings, config_keys.location_root, '/', lower=False) |
|
68 | 68 | _string_setting(settings, config_keys.reload_command, '', lower=False) |
|
69 | _string_setting(settings, config_keys.template, '', lower=False) | |
|
69 | 70 | |
|
70 | 71 | # Convert negative timeout values to zero. |
|
71 | 72 | if settings[config_keys.reload_timeout] < 0: |
@@ -27,3 +27,4 b" list_parent_path = 'svn.proxy.list_paren" | |||
|
27 | 27 | location_root = 'svn.proxy.location_root' |
|
28 | 28 | reload_command = 'svn.proxy.reload_cmd' |
|
29 | 29 | reload_timeout = 'svn.proxy.reload_timeout' |
|
30 | template = 'svn.proxy.config_template' |
@@ -28,7 +28,7 b'' | |||
|
28 | 28 | # </VirtualHost> |
|
29 | 29 | # |
|
30 | 30 | # Depending on the apache configuration you may encounter the following error if |
|
31 |
# you are using spe |
|
|
31 | # you are using special characters in your repository or repository group | |
|
32 | 32 | # names. |
|
33 | 33 | # |
|
34 | 34 | # ``Error converting entry in directory '/path/to/repo' to UTF-8`` |
@@ -18,10 +18,10 b'' | |||
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | ||
|
21 | import re | |
|
22 | import os | |
|
22 | 23 | import mock |
|
23 | 24 | import pytest |
|
24 | import re | |
|
25 | 25 | |
|
26 | 26 | from pyramid import testing |
|
27 | 27 | |
@@ -69,7 +69,8 b' class TestModDavSvnConfig(object):' | |||
|
69 | 69 | location_root=self.location_root, |
|
70 | 70 | repo_groups=repo_groups, |
|
71 | 71 | realm=self.realm, |
|
72 | use_ssl=True | |
|
72 | use_ssl=True, | |
|
73 | template='' | |
|
73 | 74 | ) |
|
74 | 75 | # Assert that one location directive exists for each repository group. |
|
75 | 76 | for group in repo_groups: |
@@ -79,6 +80,23 b' class TestModDavSvnConfig(object):' | |||
|
79 | 80 | # Assert that the root location directive exists. |
|
80 | 81 | self.assert_root_location_directive(generated_config) |
|
81 | 82 | |
|
83 | def test_render_mod_dav_svn_config_with_alternative_template(self, tmpdir): | |
|
84 | repo_groups = self.get_repo_group_mocks(count=10) | |
|
85 | test_file_path = os.path.join(str(tmpdir), 'example.mako') | |
|
86 | with open(test_file_path, 'wb') as f: | |
|
87 | f.write('TEST_EXAMPLE\n') | |
|
88 | ||
|
89 | generated_config = utils._render_mod_dav_svn_config( | |
|
90 | parent_path_root=self.parent_path_root, | |
|
91 | list_parent_path=True, | |
|
92 | location_root=self.location_root, | |
|
93 | repo_groups=repo_groups, | |
|
94 | realm=self.realm, | |
|
95 | use_ssl=True, | |
|
96 | template=test_file_path | |
|
97 | ) | |
|
98 | assert 'TEST_EXAMPLE' in generated_config | |
|
99 | ||
|
82 | 100 | @pytest.mark.parametrize('list_parent_path', [True, False]) |
|
83 | 101 | @pytest.mark.parametrize('use_ssl', [True, False]) |
|
84 | 102 | def test_list_parent_path(self, list_parent_path, use_ssl): |
@@ -88,7 +106,8 b' class TestModDavSvnConfig(object):' | |||
|
88 | 106 | location_root=self.location_root, |
|
89 | 107 | repo_groups=self.get_repo_group_mocks(count=10), |
|
90 | 108 | realm=self.realm, |
|
91 | use_ssl=use_ssl | |
|
109 | use_ssl=use_ssl, | |
|
110 | template='' | |
|
92 | 111 | ) |
|
93 | 112 | |
|
94 | 113 | # Assert that correct configuration directive is present. |
@@ -51,7 +51,7 b' def generate_mod_dav_svn_config(registry' | |||
|
51 | 51 | list_parent_path=settings[config_keys.list_parent_path], |
|
52 | 52 | location_root=settings[config_keys.location_root], |
|
53 | 53 | repo_groups=RepoGroup.get_all_repo_groups(), |
|
54 | realm=get_rhodecode_realm()) | |
|
54 | realm=get_rhodecode_realm(), template=settings[config_keys.template]) | |
|
55 | 55 | _write_mod_dav_svn_config(config, settings[config_keys.config_file_path]) |
|
56 | 56 | |
|
57 | 57 | # Trigger an event on mod dav svn configuration change. |
@@ -60,7 +60,7 b' def generate_mod_dav_svn_config(registry' | |||
|
60 | 60 | |
|
61 | 61 | def _render_mod_dav_svn_config( |
|
62 | 62 | parent_path_root, list_parent_path, location_root, repo_groups, realm, |
|
63 | use_ssl): | |
|
63 | use_ssl, template): | |
|
64 | 64 | """ |
|
65 | 65 | Render mod_dav_svn configuration to string. |
|
66 | 66 | """ |
@@ -77,11 +77,11 b' def _render_mod_dav_svn_config(' | |||
|
77 | 77 | 'repo_group_paths': repo_group_paths, |
|
78 | 78 | 'svn_list_parent_path': list_parent_path, |
|
79 | 79 | 'rhodecode_realm': realm, |
|
80 | 'use_https': use_ssl | |
|
80 | 'use_https': use_ssl, | |
|
81 | 81 | } |
|
82 | ||
|
82 | template = template or \ | |
|
83 | 'rhodecode:apps/svn_support/templates/mod-dav-svn.conf.mako' | |
|
83 | 84 | # Render the configuration template to string. |
|
84 | template = 'rhodecode:apps/svn_support/templates/mod-dav-svn.conf.mako' | |
|
85 | 85 | return render(template, context) |
|
86 | 86 | |
|
87 | 87 |
General Comments 0
You need to be logged in to leave comments.
Login now