##// END OF EJS Templates
system-settings: prepare to allow to create snapshots of full system settings...
marcink -
r280:136f6d39 default
parent child Browse files
Show More
@@ -0,0 +1,75 b''
1 <%
2 elems = [
3 ## general
4 (_('RhodeCode Enterprise version'), c.rhodecode_version, ''),
5 (_('Upgrade info endpoint'), c.rhodecode_update_url, ''),
6 (_('Configuration INI file'), c.rhodecode_config_ini, ''),
7 ## systems stats
8 (_('RhodeCode Enterprise Server IP'), c.server_ip, ''),
9 (_('RhodeCode Enterprise Server ID'), c.server_id, ''),
10 (_('Platform'), c.platform, ''),
11 (_('Uptime'), c.uptime_age, ''),
12 (_('Storage location'), c.storage, ''),
13 (_('Storage disk space'), "%s/%s, %s%% used%s" % (h.format_byte_size_binary(c.disk['used']), h.format_byte_size_binary(c.disk['total']),(c.disk['percent']), ' %s' % c.disk['error'] if 'error' in c.disk else ''), ''),
14
15 (_('Search index storage'), c.index_storage, ''),
16 (_('Search index size'), "%s %s" % (h.format_byte_size_binary(c.disk_index['used']), ' %s' % c.disk_index['error'] if 'error' in c.disk_index else ''), ''),
17
18 (_('Gist storage'), c.gist_storage, ''),
19 (_('Gist storage size'), "%s (%s items)%s" % (h.format_byte_size_binary(c.disk_gist['used']),c.disk_gist['items'], ' %s' % c.disk_gist['error'] if 'error' in c.disk_gist else ''), ''),
20
21 (_('Archive cache'), c.archive_storage, ''),
22 (_('Archive cache size'), "%s%s" % (h.format_byte_size_binary(c.disk_archive['used']), ' %s' % c.disk_archive['error'] if 'error' in c.disk_archive else ''), ''),
23
24 (_('System memory'), c.system_memory, ''),
25 (_('CPU'), '%s %%' %(c.cpu), ''),
26 (_('Load'), '1min: %s, 5min: %s, 15min: %s' %(c.load['1_min'],c.load['5_min'],c.load['15_min']), ''),
27
28 ## rhodecode stuff
29 (_('Python version'), c.py_version, ''),
30 (_('Python path'), c.py_path, ''),
31 (_('GIT version'), c.git_version, ''),
32 (_('HG version'), c.hg_version, ''),
33 (_('SVN version'), c.svn_version, ''),
34 (_('Database'), "%s @ version: %s" % (c.db_type, c.db_migrate_version), ''),
35 (_('Database version'), c.db_version, ''),
36
37 ]
38 %>
39
40 <pre>
41 SYSTEM INFO
42 -----------
43
44 % for dt, dd, tt in elems:
45 ${dt}: ${dd}
46 % endfor
47
48 PYTHON PACKAGES
49 ---------------
50
51 % for key, value in c.py_modules:
52 ${key}: ${value}
53 % endfor
54
55 SYSTEM SETTINGS
56 ---------------
57
58 % for key, value in sorted(c.rhodecode_ini_safe.items()):
59 % if isinstance(value, dict):
60
61 % for key2, value2 in value.items():
62 [${key}]${key2}: ${value2}
63 % endfor
64
65 % else:
66 ${key}: ${value}
67 % endif
68 % endfor
69
70 </pre>
71
72
73
74
75
@@ -49,7 +49,7 b' from rhodecode.lib.compat import Ordered'
49 from rhodecode.lib.ext_json import json
49 from rhodecode.lib.ext_json import json
50 from rhodecode.lib.utils import jsonify
50 from rhodecode.lib.utils import jsonify
51
51
52 from rhodecode.model.db import RhodeCodeUi, Repository
52 from rhodecode.model.db import RhodeCodeUi, Repository, User
53 from rhodecode.model.forms import ApplicationSettingsForm, \
53 from rhodecode.model.forms import ApplicationSettingsForm, \
54 ApplicationUiSettingsForm, ApplicationVisualisationForm, \
54 ApplicationUiSettingsForm, ApplicationVisualisationForm, \
55 LabsSettingsForm, IssueTrackerPatternsForm
55 LabsSettingsForm, IssueTrackerPatternsForm
@@ -60,6 +60,7 b' from rhodecode.model.meta import Session'
60 from rhodecode.model.settings import (
60 from rhodecode.model.settings import (
61 IssueTrackerSettingsModel, VcsSettingsModel, SettingNotFound,
61 IssueTrackerSettingsModel, VcsSettingsModel, SettingNotFound,
62 SettingsModel)
62 SettingsModel)
63
63 from rhodecode.model.supervisor import SupervisorModel, SUPERVISOR_MASTER
64 from rhodecode.model.supervisor import SupervisorModel, SUPERVISOR_MASTER
64
65
65
66
@@ -524,6 +525,7 b' class SettingsController(BaseController)'
524 def settings_system(self):
525 def settings_system(self):
525 """GET /admin/settings/system: All items in the collection"""
526 """GET /admin/settings/system: All items in the collection"""
526 # url('admin_settings_system')
527 # url('admin_settings_system')
528 snapshot = str2bool(request.GET.get('snapshot'))
527 c.active = 'system'
529 c.active = 'system'
528
530
529 defaults = self._form_defaults()
531 defaults = self._form_defaults()
@@ -558,6 +560,35 b' class SettingsController(BaseController)'
558 except TypeError:
560 except TypeError:
559 c.system_memory = 'NOT AVAILABLE'
561 c.system_memory = 'NOT AVAILABLE'
560
562
563 rhodecode_ini_safe = rhodecode.CONFIG.copy()
564 blacklist = [
565 'rhodecode_license_key',
566 'routes.map',
567 'pylons.h',
568 'pylons.app_globals',
569 'pylons.environ_config',
570 'sqlalchemy.db1.url',
571 ('app_conf', 'sqlalchemy.db1.url')
572 ]
573 for k in blacklist:
574 if isinstance(k, tuple):
575 section, key = k
576 if section in rhodecode_ini_safe:
577 rhodecode_ini_safe[section].pop(key, None)
578 else:
579 rhodecode_ini_safe.pop(k, None)
580
581 c.rhodecode_ini_safe = rhodecode_ini_safe
582
583 # TODO: marcink, figure out how to allow only selected users to do this
584 c.allowed_to_snapshot = False
585
586 if snapshot:
587 if c.allowed_to_snapshot:
588 return render('admin/settings/settings_system_snapshot.html')
589 else:
590 h.flash('You are not allowed to do this', category='warning')
591
561 return htmlfill.render(
592 return htmlfill.render(
562 render('admin/settings/settings.html'),
593 render('admin/settings/settings.html'),
563 defaults=defaults,
594 defaults=defaults,
@@ -45,12 +45,15 b''
45 <div class="panel panel-default">
45 <div class="panel panel-default">
46 <div class="panel-heading">
46 <div class="panel-heading">
47 <h3 class="panel-title">${_('System Info')}</h3>
47 <h3 class="panel-title">${_('System Info')}</h3>
48 % if c.allowed_to_snapshot:
49 <a href="${url('admin_settings_system', snapshot=1)}" class="panel-edit">${_('create snapshot')}</a>
50 % endif
48 </div>
51 </div>
49 <div class="panel-body">
52 <div class="panel-body">
50 <dl class="dl-horizontal settings">
53 <dl class="dl-horizontal settings">
51 %for dt, dd, tt in elems:
54 %for dt, dd, tt in elems:
52 <dt >${dt}:</dt>
55 <dt>${dt}:</dt>
53 <dd title="${tt}">${dd}</dd>
56 <dd title="${tt}">${dd}</dd>
54 %endfor
57 %endfor
55 </dl>
58 </dl>
56 </div>
59 </div>
@@ -69,7 +72,7 b''
69 <tbody>
72 <tbody>
70 %for key, value in c.py_modules:
73 %for key, value in c.py_modules:
71 <tr>
74 <tr>
72 <td >${key}</td>
75 <td>${key}</td>
73 <td>${value}</td>
76 <td>${value}</td>
74 </tr>
77 </tr>
75 %endfor
78 %endfor
General Comments 0
You need to be logged in to leave comments. Login now