pmb.install.blockdevice: Avoid reusing size_mb variable in create_and_mount_image() (MR 2464)

Reusing this variable might lead to confusing bugs later if this code is
changed in the future, and also leads to mypy being confused about the
type of size_mb as it then gets assigned both str and int values.
This commit is contained in:
Newbyte 2024-10-29 14:21:01 +01:00
parent f507aed9aa
commit 1aa0b05014
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -105,9 +105,9 @@ def create_and_mount_image(args: PmbArgs, size_boot, size_root, size_reserve, sp
images = {img_path_full: size_mb_full} images = {img_path_full: size_mb_full}
if split: if split:
images = {img_path_boot: size_mb_boot, img_path_root: size_mb_root} images = {img_path_boot: size_mb_boot, img_path_root: size_mb_root}
for img_path, size_mb in images.items(): for img_path, image_size_mb in images.items():
logging.info(f"(native) create {img_path.name} " f"({size_mb})") logging.info(f"(native) create {img_path.name} " f"({image_size_mb})")
pmb.chroot.root(["truncate", "-s", size_mb, img_path]) pmb.chroot.root(["truncate", "-s", image_size_mb, img_path])
# Mount to /dev/install # Mount to /dev/install
mount_image_paths = {img_path_full: "/dev/install"} mount_image_paths = {img_path_full: "/dev/install"}