fixed type hinting circular import error
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Mathieu Broillet 2023-06-13 16:29:40 +02:00
parent 4e1b2d7dd4
commit 8af5cbce58
No known key found for this signature in database
GPG Key ID: 7D4F25BC50A0AA32
4 changed files with 22 additions and 6 deletions

View File

@ -1,9 +1,14 @@
from pathlib import Path
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from . import LXC
from ..utils import proxmox_utils
from ..utils.resources_utils import get_path
if TYPE_CHECKING:
from . import LXC
def run_script(lxc: LXC, step: dict):
"""Method use to dispatch the script to the correct method depending on the type of script, being

View File

@ -1,9 +1,15 @@
from __future__ import annotations
import logging
from pathlib import Path
from typing import TYPE_CHECKING
from . import commands_utils, LXC
from . import commands_utils
from ..utils.resources_utils import get_path
if TYPE_CHECKING:
from . import LXC
def are_all_conditions_met(lxc: LXC):
"""

View File

@ -11,7 +11,7 @@ def run():
# Go through each LXC file
for resource in resources:
if resource == "lxc":
if resource.name == "lxc":
# Read all files in the LXC directory
lxc_folders = Path(project_path).joinpath("resources", "lxc").glob("*")
for lxc_folder in lxc_folders:

View File

@ -1,6 +1,11 @@
from __future__ import annotations
import pathlib
from typing import TYPE_CHECKING
from .. import project_path
if TYPE_CHECKING:
from ..lxc import LXC
@ -41,4 +46,4 @@ def get_path(lxc: LXC, path: str):
else:
# Use VM/LXC folder
lxc_id = lxc.get_id()
return parent.joinpath("lxc", lxc_id, path)
return parent.joinpath("lxc", str(lxc_id), path)