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