Extract log action

This commit is contained in:
jonct 2024-07-15 02:09:38 -04:00
parent f29e0bc075
commit a08149daea
No known key found for this signature in database
2 changed files with 17 additions and 11 deletions

16
src/jlmkr/actions/log.py Normal file
View File

@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: © 2024 Jip-Hop and the Jailmakers <https://github.com/Jip-Hop/jailmaker>
#
# SPDX-License-Identifier: LGPL-3.0-only
import subprocess
from utils.paths import SHORTNAME
def log_jail(jail_name, args):
"""
Show the log file of the jail with given name.
"""
return subprocess.run(
["journalctl", "-u", f"{SHORTNAME}-{jail_name}", *args]
).returncode

View File

@ -143,17 +143,7 @@ from utils.jail_dataset import get_jail_path, get_jail_config_path, get_jail_roo
from actions.exec import exec_jail from actions.exec import exec_jail
from actions.status import status_jail from actions.status import status_jail
from actions.log import log_jail
def log_jail(jail_name, args):
"""
Show the log file of the jail with given name.
"""
return subprocess.run(
["journalctl", "-u", f"{SHORTNAME}-{jail_name}", *args]
).returncode
from actions.shell import shell_jail from actions.shell import shell_jail
from actions.start import start_jail from actions.start import start_jail
from actions.restart import restart_jail from actions.restart import restart_jail