mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
help: Add action script to read logs from journal
Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
1 parent
27cfd4786a
commit
5a8873508d
2 files changed
+58
-11
No files matched your search
@@ -20,7 +20,6 @@ Help app for FreedomBox.
|
||||
|
||||
import mimetypes
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from apt.cache import Cache
|
||||
from django.core.files.base import File
|
||||
@@ -29,7 +28,7 @@ from django.template.response import TemplateResponse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext_lazy
|
||||
|
||||
from plinth import __version__, cfg
|
||||
from plinth import __version__, actions, cfg
|
||||
from plinth.menu import main_menu
|
||||
|
||||
|
||||
@@ -105,15 +104,8 @@ def download_manual(request):
|
||||
|
||||
def status_log(request):
|
||||
"""Serve the last 100 lines of plinth's status log"""
|
||||
num_lines = 100
|
||||
command = [
|
||||
'journalctl', '--no-pager', '-n',
|
||||
str(num_lines), '-u', 'plinth'
|
||||
]
|
||||
process = subprocess.run(command, stdout=subprocess.PIPE, check=True)
|
||||
data = process.stdout.decode()
|
||||
|
||||
context = {'num_lines': num_lines, 'data': data}
|
||||
output = actions.superuser_run('help', ['get-logs'])
|
||||
context = {'num_lines': 100, 'data': output}
|
||||
return TemplateResponse(request, 'statuslog.html', context)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user