fix(image-manager): Fix type-check errors in image uploads and appliance installation

This commit is contained in:
Cristi 2026-10-06 00:13:53 +03:00
parent a7f0c7174b
commit 5492105e58
2 changed files with 5 additions and 3 deletions

View File

@ -254,6 +254,8 @@ class ApplianceManager:
)
try:
image_in_db = await images_repo.save_verified_image(image_info)
if image_in_db is None:
raise ControllerError(f"Could not register image '{image_path}'")
version_images[appliance_key] = self._image_reference(image_in_db)
except SQLAlchemyError as e:
raise ControllerError(f"Could not register image '{image_path}': {e}") from e

View File

@ -424,8 +424,8 @@ async def write_image(
f"File '{image_path}' already exists, "
f"please choose a different name or remove the existing image"
)
checksum = checksum.hexdigest()
duplicate_image = await images_repo.get_image_by_checksum(checksum, os.path.dirname(image_path))
checksum_str = checksum.hexdigest()
duplicate_image = await images_repo.get_image_by_checksum(checksum_str, os.path.dirname(image_path))
if duplicate_image:
raise InvalidImageError(
f"Image '{duplicate_image.filename}' with the same checksum "
@ -439,7 +439,7 @@ async def write_image(
image_type=image_type,
image_size=image_size,
path=image_path,
checksum=checksum,
checksum=checksum_str,
checksum_algorithm="md5",
file_fingerprint=file_fingerprint,
)