mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
help: Use journalctl to show status log
The status log file had been removed previously. Closes #1461 Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
c79b9b276f
commit
27cfd4786a
@ -20,6 +20,7 @@ Help app for FreedomBox.
|
|||||||
|
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from apt.cache import Cache
|
from apt.cache import Cache
|
||||||
from django.core.files.base import File
|
from django.core.files.base import File
|
||||||
@ -37,8 +38,7 @@ def init():
|
|||||||
menu = main_menu.add_urlname(
|
menu = main_menu.add_urlname(
|
||||||
ugettext_lazy('Documentation'), 'fa-book', 'help:index')
|
ugettext_lazy('Documentation'), 'fa-book', 'help:index')
|
||||||
menu.add_urlname(
|
menu.add_urlname(
|
||||||
ugettext_lazy('Manual'), 'fa-info-circle', 'help:manual',
|
ugettext_lazy('Manual'), 'fa-info-circle', 'help:manual', order=10)
|
||||||
order=10)
|
|
||||||
menu.add_urlname(
|
menu.add_urlname(
|
||||||
ugettext_lazy('Download Manual'), 'fa-download',
|
ugettext_lazy('Download Manual'), 'fa-download',
|
||||||
'help:download-manual', order=15)
|
'help:download-manual', order=15)
|
||||||
@ -48,9 +48,8 @@ def init():
|
|||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
"""Serve the index page"""
|
"""Serve the index page"""
|
||||||
return TemplateResponse(request, 'help_index.html', {
|
return TemplateResponse(request, 'help_index.html',
|
||||||
'title': _('Documentation and FAQ')
|
{'title': _('Documentation and FAQ')})
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def about(request):
|
def about(request):
|
||||||
@ -107,10 +106,13 @@ def download_manual(request):
|
|||||||
def status_log(request):
|
def status_log(request):
|
||||||
"""Serve the last 100 lines of plinth's status log"""
|
"""Serve the last 100 lines of plinth's status log"""
|
||||||
num_lines = 100
|
num_lines = 100
|
||||||
with open(cfg.status_log_file, 'r') as log_file:
|
command = [
|
||||||
data = log_file.readlines()
|
'journalctl', '--no-pager', '-n',
|
||||||
|
str(num_lines), '-u', 'plinth'
|
||||||
|
]
|
||||||
|
process = subprocess.run(command, stdout=subprocess.PIPE, check=True)
|
||||||
|
data = process.stdout.decode()
|
||||||
|
|
||||||
data = ''.join(data[-num_lines:])
|
|
||||||
context = {'num_lines': num_lines, 'data': data}
|
context = {'num_lines': num_lines, 'data': data}
|
||||||
return TemplateResponse(request, 'statuslog.html', context)
|
return TemplateResponse(request, 'statuslog.html', context)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user