refactor(services): fix type annotation

pull/98/head
Houkime 2024-02-19 00:24:32 +00:00 committed by Inex Code
parent c22802f693
commit ddca1b0cde
2 changed files with 4 additions and 3 deletions

View File

@ -19,7 +19,7 @@ def get_foldername(p: OwnedPath) -> str:
return p.path.split("/")[-1]
def check_volume(volume: BlockDevice, space_needed: int) -> bool:
def check_volume(volume: BlockDevice, space_needed: int) -> None:
# Check if there is enough space on the new volume
if int(volume.fsavail) < space_needed:
raise MoveError("Not enough space on the new volume.")
@ -55,7 +55,7 @@ def unbind_folders(owned_folders: List[OwnedPath]) -> None:
def move_folders_to_volume(
folders: List[OwnedPath],
old_volume: BlockDevice,
old_volume_name: str, # TODO: pass an actual validated block device
new_volume: BlockDevice,
job: Job,
) -> None:
@ -67,7 +67,7 @@ def move_folders_to_volume(
for folder in folders:
folder_name = get_foldername(folder)
shutil.move(
f"/volumes/{old_volume}/{folder_name}",
f"/volumes/{old_volume_name}/{folder_name}",
f"/volumes/{new_volume.name}/{folder_name}",
)
progress = current_progress + folder_percentage

View File

@ -353,6 +353,7 @@ class Service(ABC):
Move a service to another volume.
"""
service_name = self.get_display_name()
# TODO: validate that this volume exists
old_volume_name = self.get_drive()
owned_folders = self.get_owned_folders()