diff --git a/src/jlmkr/actions/log.py b/src/jlmkr/actions/log.py new file mode 100644 index 0000000..b0e7b32 --- /dev/null +++ b/src/jlmkr/actions/log.py @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: © 2024 Jip-Hop and the Jailmakers +# +# 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 diff --git a/src/jlmkr/donor/jlmkr.py b/src/jlmkr/donor/jlmkr.py index 9325280..ca4bf44 100755 --- a/src/jlmkr/donor/jlmkr.py +++ b/src/jlmkr/donor/jlmkr.py @@ -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.status import status_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.log import log_jail from actions.shell import shell_jail from actions.start import start_jail from actions.restart import restart_jail