From 2feb8739f46bb8375225f9341e29077ea679032d Mon Sep 17 00:00:00 2001
From: jonct <2807816+jonct@users.noreply.github.com>
Date: Mon, 15 Jul 2024 04:06:44 -0400
Subject: [PATCH] Extract startup action

---
 src/jlmkr/actions/startup.py | 21 +++++++++++++++++++++
 src/jlmkr/donor/jlmkr.py     | 15 +--------------
 2 files changed, 22 insertions(+), 14 deletions(-)
 create mode 100644 src/jlmkr/actions/startup.py

diff --git a/src/jlmkr/actions/startup.py b/src/jlmkr/actions/startup.py
new file mode 100644
index 0000000..8314f8a
--- /dev/null
+++ b/src/jlmkr/actions/startup.py
@@ -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
diff --git a/src/jlmkr/donor/jlmkr.py b/src/jlmkr/donor/jlmkr.py
index 8fa2a5f..12110ee 100755
--- a/src/jlmkr/donor/jlmkr.py
+++ b/src/jlmkr/donor/jlmkr.py
@@ -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):