diff --git a/CHANGES b/CHANGES index 7094f5866..25437c09f 100644 --- a/CHANGES +++ b/CHANGES @@ -38,6 +38,8 @@ This release contains contributions from (alphabetically by first name): * New module *fsresizer* can be used to resize filesystems. It is intended for use in OEM installs where an image of fixed size is created, and then sized to the actual SD card the user has used. + * The *mount* module now handles missing *extraMounts* and *extraMountsEfi* + keys gracefully (this is probably a misconfiguration issue). # 3.2.2 (2018-09-04) # diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index 16e7a1f89..29d04e310 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -124,25 +124,24 @@ def run(): """ root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") partitions = libcalamares.globalstorage.value("partitions") - extra_mounts = libcalamares.job.configuration["extraMounts"] - extra_mounts_efi = libcalamares.job.configuration["extraMountsEfi"] + + # Guard against missing keys (generally a sign that the config file is bad) + extra_mounts = libcalamares.job.configuration.get("extraMounts") or [] + extra_mounts_efi = libcalamares.job.configuration.get("extraMountsEfi") or [] + if not extra_mounts and not extra_mounts_efi: + libcalamares.utils.warning("No extra mounts defined. Does mount.conf exist?") # Sort by mount points to ensure / is mounted before the rest partitions.sort(key=lambda x: x["mountPoint"]) mount_partitions(root_mount_point, partitions) mount_partitions(root_mount_point, extra_mounts) - fw_type = libcalamares.globalstorage.value("firmwareType") - if fw_type == 'efi': + all_extra_mounts = extra_mounts + if libcalamares.globalstorage.value("firmwareType") == "efi": mount_partitions(root_mount_point, extra_mounts_efi) + all_extra_mounts.extend(extra_mounts_efi) libcalamares.globalstorage.insert("rootMountPoint", root_mount_point) # Remember the extra mounts for the unpackfs module - if fw_type == 'efi': - libcalamares.globalstorage.insert( - "extraMounts", extra_mounts + extra_mounts_efi) - else: - libcalamares.globalstorage.insert("extraMounts", extra_mounts) - - return None + libcalamares.globalstorage.insert("extraMounts", all_extra_mounts)