Show More
@@ -46,6 +46,7 b' class TestGetServerInfo(object):' | |||
|
46 | 46 | expected['load'] = resp['result']['load'] |
|
47 | 47 | expected['cpu'] = resp['result']['cpu'] |
|
48 | 48 | expected['storage'] = resp['result']['storage'] |
|
49 | expected['storage_temp'] = resp['result']['storage_temp'] | |
|
49 | 50 | expected['storage_inodes'] = resp['result']['storage_inodes'] |
|
50 | 51 | expected['server'] = resp['result']['server'] |
|
51 | 52 | |
@@ -61,6 +62,7 b' class TestGetServerInfo(object):' | |||
|
61 | 62 | expected['load'] = resp['result']['load'] |
|
62 | 63 | expected['cpu'] = resp['result']['cpu'] |
|
63 | 64 | expected['storage'] = resp['result']['storage'] |
|
65 | expected['storage_temp'] = resp['result']['storage_temp'] | |
|
64 | 66 | expected['storage_inodes'] = resp['result']['storage_inodes'] |
|
65 | 67 | expected['server'] = resp['result']['server'] |
|
66 | 68 |
@@ -613,6 +613,9 b' class SettingsController(BaseController)' | |||
|
613 | 613 | (_('Archive cache storage location'), val('storage_archive')['path'], state('storage_archive')), |
|
614 | 614 | (_('Archive cache info'), val('storage_archive')['text'], state('storage_archive')), |
|
615 | 615 | |
|
616 | (_('Temp storage location'), val('storage_temp')['path'], state('storage_temp')), | |
|
617 | (_('Temp storage info'), val('storage_temp')['text'], state('storage_temp')), | |
|
618 | ||
|
616 | 619 | (_('Search info'), val('search')['text'], state('search')), |
|
617 | 620 | (_('Search location'), val('search')['location'], state('search')), |
|
618 | 621 | ('', '', ''), # spacer |
@@ -367,6 +367,34 b' def storage_gist():' | |||
|
367 | 367 | return SysInfoRes(value=value, state=state, human_value=human_value) |
|
368 | 368 | |
|
369 | 369 | |
|
370 | def storage_temp(): | |
|
371 | import tempfile | |
|
372 | from rhodecode.lib.helpers import format_byte_size_binary | |
|
373 | ||
|
374 | path = tempfile.gettempdir() | |
|
375 | value = dict(percent=0, used=0, total=0, items=0, path=path, text='') | |
|
376 | state = STATE_OK_DEFAULT | |
|
377 | ||
|
378 | if not psutil: | |
|
379 | return SysInfoRes(value=value, state=state) | |
|
380 | ||
|
381 | try: | |
|
382 | value.update(dict(psutil.disk_usage(path)._asdict())) | |
|
383 | except Exception as e: | |
|
384 | log.exception('Failed to fetch temp dir info') | |
|
385 | state = {'message': str(e), 'type': STATE_ERR} | |
|
386 | ||
|
387 | human_value = value.copy() | |
|
388 | human_value['used'] = format_byte_size_binary(value['used']) | |
|
389 | human_value['total'] = format_byte_size_binary(value['total']) | |
|
390 | human_value['text'] = "{}/{}, {}% used".format( | |
|
391 | format_byte_size_binary(value['used']), | |
|
392 | format_byte_size_binary(value['total']), | |
|
393 | value['percent']) | |
|
394 | ||
|
395 | return SysInfoRes(value=value, state=state, human_value=human_value) | |
|
396 | ||
|
397 | ||
|
370 | 398 | def search_info(): |
|
371 | 399 | import rhodecode |
|
372 | 400 | from rhodecode.lib.index import searcher_from_config |
@@ -595,6 +623,7 b' def get_system_info(environ):' | |||
|
595 | 623 | 'storage_inodes': SysInfo(storage_inodes)(), |
|
596 | 624 | 'storage_archive': SysInfo(storage_archives)(), |
|
597 | 625 | 'storage_gist': SysInfo(storage_gist)(), |
|
626 | 'storage_temp': SysInfo(storage_temp)(), | |
|
598 | 627 | |
|
599 | 628 | 'search': SysInfo(search_info)(), |
|
600 | 629 |
General Comments 0
You need to be logged in to leave comments.
Login now