configured mutli-threading and fixed lxc detection for steps
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ea6266b433
commit
a503ad16c0
13
src/main.py
13
src/main.py
@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
from .lxc.lxc_utils import load_lxc, get_all_lxcs
|
||||
@ -44,7 +45,11 @@ def run(args):
|
||||
load_lxc(content=lxc_file_content, lxc_id=int(lxc_folder), pve=pve)
|
||||
|
||||
for lxc in get_all_lxcs():
|
||||
logging.info(f"Loading LXC {lxc.id}")
|
||||
lxc.create()
|
||||
lxc.start()
|
||||
lxc.run_creation()
|
||||
threading.Thread(target=launch_lxc, args=(lxc,)).start()
|
||||
|
||||
|
||||
def launch_lxc(lxc):
|
||||
logging.info(f"Loading LXC {lxc.id}")
|
||||
lxc.create()
|
||||
lxc.start()
|
||||
lxc.run_creation()
|
||||
|
@ -11,14 +11,14 @@ from ..machine.machine import LinuxMachine
|
||||
from ..utils import conditions_utils
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..lxc.lxc import LXC
|
||||
pass
|
||||
|
||||
|
||||
def _run_script_step(linux_machine, step):
|
||||
if isinstance(linux_machine, LXC):
|
||||
if "LXC" in str(linux_machine.__class__):
|
||||
lxc_utils.run_script_step_parser(linux_machine, step)
|
||||
else:
|
||||
logging.warning(f"Script step only supported on LXCs")
|
||||
logging.warning("Script step only supported on LXCs")
|
||||
pass
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ def _run_file_create_step(linux_machine, step):
|
||||
|
||||
|
||||
def _run_file_copy_step(linux_machine, step):
|
||||
if isinstance(linux_machine, LXC):
|
||||
if "LXC" in str(linux_machine.__class__):
|
||||
linux_machine.pve.copy_file_to_lxc(linux_machine, get_path(linux_machine, step["path"]), step["destination"],
|
||||
step.get("permission", 644), step.get("owner", "root"))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user