Show More
@@ -101,9 +101,6 b' class NavigationRegistry(object):' | |||||
101 | NavEntry('open_source', _('Open Source Licenses'), |
|
101 | NavEntry('open_source', _('Open Source Licenses'), | |
102 | 'admin_settings_open_source', pyramid=True), |
|
102 | 'admin_settings_open_source', pyramid=True), | |
103 |
|
103 | |||
104 | # TODO: marcink: we disable supervisor now until the supervisor stats |
|
|||
105 | # page is fixed in the nix configuration |
|
|||
106 | # NavEntry('supervisor', _('Supervisor'), 'admin_settings_supervisor'), |
|
|||
107 | ] |
|
104 | ] | |
108 |
|
105 | |||
109 | _labs_entry = NavEntry('labs', _('Labs'), 'admin_settings_labs') |
|
106 | _labs_entry = NavEntry('labs', _('Labs'), 'admin_settings_labs') |
@@ -145,7 +145,9 b' def make_pyramid_app(global_config, **se' | |||||
145 |
|
145 | |||
146 | add_pylons_compat_data(config.registry, global_config, settings.copy()) |
|
146 | add_pylons_compat_data(config.registry, global_config, settings.copy()) | |
147 |
|
147 | |||
|
148 | # Static file view comes first | |||
148 | includeme_first(config) |
|
149 | includeme_first(config) | |
|
150 | ||||
149 | includeme(config) |
|
151 | includeme(config) | |
150 |
|
152 | |||
151 | pyramid_app = config.make_wsgi_app() |
|
153 | pyramid_app = config.make_wsgi_app() |
@@ -241,11 +241,6 b' def make_map(config):' | |||||
241 | m.connect('admin_settings_search', '/settings/search', |
|
241 | m.connect('admin_settings_search', '/settings/search', | |
242 | action='settings_search', conditions={'method': ['GET']}) |
|
242 | action='settings_search', conditions={'method': ['GET']}) | |
243 |
|
243 | |||
244 | m.connect('admin_settings_supervisor', '/settings/supervisor', |
|
|||
245 | action='settings_supervisor', conditions={'method': ['GET']}) |
|
|||
246 | m.connect('admin_settings_supervisor_log', '/settings/supervisor/{procid}/log', |
|
|||
247 | action='settings_supervisor_log', conditions={'method': ['GET']}) |
|
|||
248 |
|
||||
249 | m.connect('admin_settings_labs', '/settings/labs', |
|
244 | m.connect('admin_settings_labs', '/settings/labs', | |
250 | action='settings_labs_update', |
|
245 | action='settings_labs_update', | |
251 | conditions={'method': ['POST']}) |
|
246 | conditions={'method': ['POST']}) |
@@ -47,7 +47,6 b' from rhodecode.lib.celerylib import task' | |||||
47 | from rhodecode.lib.utils import repo2db_mapper |
|
47 | from rhodecode.lib.utils import repo2db_mapper | |
48 | from rhodecode.lib.utils2 import ( |
|
48 | from rhodecode.lib.utils2 import ( | |
49 | str2bool, safe_unicode, AttributeDict, safe_int) |
|
49 | str2bool, safe_unicode, AttributeDict, safe_int) | |
50 | from rhodecode.lib.compat import OrderedDict |
|
|||
51 |
|
50 | |||
52 | from rhodecode.model.db import RhodeCodeUi, Repository |
|
51 | from rhodecode.model.db import RhodeCodeUi, Repository | |
53 | from rhodecode.model.forms import ApplicationSettingsForm, \ |
|
52 | from rhodecode.model.forms import ApplicationSettingsForm, \ | |
@@ -62,8 +61,6 b' from rhodecode.model.settings import (' | |||||
62 | IssueTrackerSettingsModel, VcsSettingsModel, SettingNotFound, |
|
61 | IssueTrackerSettingsModel, VcsSettingsModel, SettingNotFound, | |
63 | SettingsModel) |
|
62 | SettingsModel) | |
64 |
|
63 | |||
65 | from rhodecode.model.supervisor import SupervisorModel, SUPERVISOR_MASTER |
|
|||
66 |
|
||||
67 |
|
64 | |||
68 | log = logging.getLogger(__name__) |
|
65 | log = logging.getLogger(__name__) | |
69 |
|
66 | |||
@@ -545,69 +542,6 b' class SettingsController(BaseController)' | |||||
545 | return render('admin/settings/settings.mako') |
|
542 | return render('admin/settings/settings.mako') | |
546 |
|
543 | |||
547 | @HasPermissionAllDecorator('hg.admin') |
|
544 | @HasPermissionAllDecorator('hg.admin') | |
548 | def settings_supervisor(self): |
|
|||
549 | c.rhodecode_ini = rhodecode.CONFIG |
|
|||
550 | c.active = 'supervisor' |
|
|||
551 |
|
||||
552 | c.supervisor_procs = OrderedDict([ |
|
|||
553 | (SUPERVISOR_MASTER, {}), |
|
|||
554 | ]) |
|
|||
555 |
|
||||
556 | c.log_size = 10240 |
|
|||
557 | supervisor = SupervisorModel() |
|
|||
558 |
|
||||
559 | _connection = supervisor.get_connection( |
|
|||
560 | c.rhodecode_ini.get('supervisor.uri')) |
|
|||
561 | c.connection_error = None |
|
|||
562 | try: |
|
|||
563 | _connection.supervisor.getAllProcessInfo() |
|
|||
564 | except Exception as e: |
|
|||
565 | c.connection_error = str(e) |
|
|||
566 | log.exception("Exception reading supervisor data") |
|
|||
567 | return render('admin/settings/settings.mako') |
|
|||
568 |
|
||||
569 | groupid = c.rhodecode_ini.get('supervisor.group_id') |
|
|||
570 |
|
||||
571 | # feed our group processes to the main |
|
|||
572 | for proc in supervisor.get_group_processes(_connection, groupid): |
|
|||
573 | c.supervisor_procs[proc['name']] = {} |
|
|||
574 |
|
||||
575 | for k in c.supervisor_procs.keys(): |
|
|||
576 | try: |
|
|||
577 | # master process info |
|
|||
578 | if k == SUPERVISOR_MASTER: |
|
|||
579 | _data = supervisor.get_master_state(_connection) |
|
|||
580 | _data['name'] = 'supervisor master' |
|
|||
581 | _data['description'] = 'pid %s, id: %s, ver: %s' % ( |
|
|||
582 | _data['pid'], _data['id'], _data['ver']) |
|
|||
583 | c.supervisor_procs[k] = _data |
|
|||
584 | else: |
|
|||
585 | procid = groupid + ":" + k |
|
|||
586 | c.supervisor_procs[k] = supervisor.get_process_info(_connection, procid) |
|
|||
587 | except Exception as e: |
|
|||
588 | log.exception("Exception reading supervisor data") |
|
|||
589 | c.supervisor_procs[k] = {'_rhodecode_error': str(e)} |
|
|||
590 |
|
||||
591 | return render('admin/settings/settings.mako') |
|
|||
592 |
|
||||
593 | @HasPermissionAllDecorator('hg.admin') |
|
|||
594 | def settings_supervisor_log(self, procid): |
|
|||
595 | import rhodecode |
|
|||
596 | c.rhodecode_ini = rhodecode.CONFIG |
|
|||
597 | c.active = 'supervisor_tail' |
|
|||
598 |
|
||||
599 | supervisor = SupervisorModel() |
|
|||
600 | _connection = supervisor.get_connection(c.rhodecode_ini.get('supervisor.uri')) |
|
|||
601 | groupid = c.rhodecode_ini.get('supervisor.group_id') |
|
|||
602 | procid = groupid + ":" + procid if procid != SUPERVISOR_MASTER else procid |
|
|||
603 |
|
||||
604 | c.log_size = 10240 |
|
|||
605 | offset = abs(safe_int(request.GET.get('offset', c.log_size))) * -1 |
|
|||
606 | c.log = supervisor.read_process_log(_connection, procid, offset, 0) |
|
|||
607 |
|
||||
608 | return render('admin/settings/settings.mako') |
|
|||
609 |
|
||||
610 | @HasPermissionAllDecorator('hg.admin') |
|
|||
611 | @auth.CSRFRequired() |
|
545 | @auth.CSRFRequired() | |
612 | def settings_labs_update(self): |
|
546 | def settings_labs_update(self): | |
613 | """POST /admin/settings/labs: All items in the collection""" |
|
547 | """POST /admin/settings/labs: All items in the collection""" |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now