Show More
@@ -0,0 +1,35 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | ||||
|
3 | # Copyright (C) 2016-2017 RhodeCode GmbH | |||
|
4 | # | |||
|
5 | # This program is free software: you can redistribute it and/or modify | |||
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |||
|
7 | # (only), as published by the Free Software Foundation. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU Affero General Public License | |||
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
|
16 | # | |||
|
17 | # This program is dual-licensed. If you wish to learn more about the | |||
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |||
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |||
|
20 | ||||
|
21 | from rhodecode.config.routing import ADMIN_PREFIX | |||
|
22 | ||||
|
23 | ||||
|
24 | def admin_routes(config): | |||
|
25 | config.add_route( | |||
|
26 | name='ops_ping', | |||
|
27 | pattern='/ping') | |||
|
28 | ||||
|
29 | ||||
|
30 | def includeme(config): | |||
|
31 | ||||
|
32 | config.include(admin_routes, route_prefix=ADMIN_PREFIX + '/ops') | |||
|
33 | ||||
|
34 | # Scan module for configuration decorators. | |||
|
35 | config.scan() |
@@ -0,0 +1,54 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | ||||
|
3 | # Copyright (C) 2016-2017 RhodeCode GmbH | |||
|
4 | # | |||
|
5 | # This program is free software: you can redistribute it and/or modify | |||
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |||
|
7 | # (only), as published by the Free Software Foundation. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU Affero General Public License | |||
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
|
16 | # | |||
|
17 | # This program is dual-licensed. If you wish to learn more about the | |||
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |||
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |||
|
20 | ||||
|
21 | import logging | |||
|
22 | ||||
|
23 | from pyramid.view import view_config | |||
|
24 | ||||
|
25 | from rhodecode.apps._base import BaseAppView | |||
|
26 | ||||
|
27 | ||||
|
28 | log = logging.getLogger(__name__) | |||
|
29 | ||||
|
30 | ||||
|
31 | class OpsView(BaseAppView): | |||
|
32 | ||||
|
33 | def load_default_context(self): | |||
|
34 | c = self._get_local_tmpl_context() | |||
|
35 | c.user = c.auth_user.get_instance() | |||
|
36 | self._register_global_c(c) | |||
|
37 | return c | |||
|
38 | ||||
|
39 | @view_config( | |||
|
40 | route_name='ops_ping', request_method='GET', | |||
|
41 | renderer='json_ext') | |||
|
42 | def ops_ping(self): | |||
|
43 | data = { | |||
|
44 | 'instance': self.request.registry.settings.get('instance_id'), | |||
|
45 | } | |||
|
46 | if getattr(self.request, 'user'): | |||
|
47 | data.update({ | |||
|
48 | 'caller_ip': self.request.user.ip_addr, | |||
|
49 | 'caller_name': self.request.user.username, | |||
|
50 | }) | |||
|
51 | return {'ok': data} | |||
|
52 | ||||
|
53 | ||||
|
54 |
@@ -284,6 +284,7 b' def includeme(config):' | |||||
284 |
|
284 | |||
285 | # apps |
|
285 | # apps | |
286 | config.include('rhodecode.apps._base') |
|
286 | config.include('rhodecode.apps._base') | |
|
287 | config.include('rhodecode.apps.ops') | |||
287 |
|
288 | |||
288 | config.include('rhodecode.apps.admin') |
|
289 | config.include('rhodecode.apps.admin') | |
289 | config.include('rhodecode.apps.channelstream') |
|
290 | config.include('rhodecode.apps.channelstream') |
@@ -207,6 +207,7 b' class SettingsModel(BaseModel):' | |||||
207 | caches.clear_cache_manager(cache_manager) |
|
207 | caches.clear_cache_manager(cache_manager) | |
208 |
|
208 | |||
209 | def get_all_settings(self, cache=False): |
|
209 | def get_all_settings(self, cache=False): | |
|
210 | ||||
210 | def _compute(): |
|
211 | def _compute(): | |
211 | q = self._get_settings_query() |
|
212 | q = self._get_settings_query() | |
212 | if not q: |
|
213 | if not q: |
@@ -71,6 +71,7 b' function registerRCRoutes() {' | |||||
71 | pyroutes.register('repo_integrations_new', '%(repo_name)s/settings/integrations/new', ['repo_name']); |
|
71 | pyroutes.register('repo_integrations_new', '%(repo_name)s/settings/integrations/new', ['repo_name']); | |
72 | pyroutes.register('repo_integrations_create', '%(repo_name)s/settings/integrations/%(integration)s/new', ['repo_name', 'integration']); |
|
72 | pyroutes.register('repo_integrations_create', '%(repo_name)s/settings/integrations/%(integration)s/new', ['repo_name', 'integration']); | |
73 | pyroutes.register('repo_integrations_edit', '%(repo_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_name', 'integration', 'integration_id']); |
|
73 | pyroutes.register('repo_integrations_edit', '%(repo_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_name', 'integration', 'integration_id']); | |
|
74 | pyroutes.register('ops_ping', '_admin/ops/ping', []); | |||
74 | pyroutes.register('admin_settings_open_source', '_admin/settings/open_source', []); |
|
75 | pyroutes.register('admin_settings_open_source', '_admin/settings/open_source', []); | |
75 | pyroutes.register('admin_settings_vcs_svn_generate_cfg', '_admin/settings/vcs/svn_generate_cfg', []); |
|
76 | pyroutes.register('admin_settings_vcs_svn_generate_cfg', '_admin/settings/vcs/svn_generate_cfg', []); | |
76 | pyroutes.register('admin_settings_system', '_admin/settings/system', []); |
|
77 | pyroutes.register('admin_settings_system', '_admin/settings/system', []); |
General Comments 0
You need to be logged in to leave comments.
Login now