Skip to content

Commit

Permalink
Extract startup action
Browse files Browse the repository at this point in the history
  • Loading branch information
jonct committed Jul 15, 2024
1 parent 3125b13 commit 2feb873
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
21 changes: 21 additions & 0 deletions src/jlmkr/actions/startup.py
Original file line number Diff line number Diff line change
@@ -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
15 changes: 1 addition & 14 deletions src/jlmkr/donor/jlmkr.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,7 @@ def error(self, message):

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):
Expand Down

0 comments on commit 2feb873

Please sign in to comment.