Extract startup action

This commit is contained in:
jonct 2024-07-15 04:06:44 -04:00
parent 3125b13aa2
commit 2feb8739f4
No known key found for this signature in database
2 changed files with 22 additions and 14 deletions

View File

@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: © 2024 Jip-Hop and the Jailmakers <https://github.com/Jip-Hop/jailmaker>
#
# SPDX-License-Identifier: LGPL-3.0-only
from actions.start import start_jail
from utils.dataset import get_all_jail_names, get_jail_config_path
from utils.config_parser import parse_config_file
def startup_jails():
start_failure = False
for jail_name in get_all_jail_names():
config = parse_config_file(get_jail_config_path(jail_name))
if config and config.my_getboolean("startup"):
if start_jail(jail_name) != 0:
start_failure = True
if start_failure:
return 1
return 0

View File

@ -95,20 +95,7 @@ from actions.remove import remove_jail
from utils.dataset import get_all_jail_names, parse_os_release
from actions.list import list_jails
def startup_jails():
start_failure = False
for jail_name in get_all_jail_names():
config = parse_config_file(get_jail_config_path(jail_name))
if config and config.my_getboolean("startup"):
if start_jail(jail_name) != 0:
start_failure = True
if start_failure:
return 1
return 0
from actions.startup import startup_jails
def split_at_string(lst, string):