[fstab] Don't fail with a KeyError in misconfigured installations

Use get() instead of [] to avoid KeyError when the host system
confuguration is entirely missing a setting for *mountOptions*.

FIXES #1702
This commit is contained in:
Adriaan de Groot 2021-05-24 22:16:54 +02:00
parent 98ebb6f8d1
commit e186e54434

View File

@ -378,9 +378,17 @@ def run():
swap_choice = None
libcalamares.job.setprogress(0.1)
mount_options = conf["mountOptions"]
mount_options = conf.get("mountOptions", {})
ssd_extra_mount_options = conf.get("ssdExtraMountOptions", {})
crypttab_options = conf.get("crypttabOptions", "luks")
# We rely on mount_options having a default; if there wasn't one,
# bail out with a meaningful error.
if not mount_options:
return (_("Configuration Error"),
_("No <pre>{!s}</pre> configuration is given for <pre>{!s}</pre> to use.")
.format("mountOptions", "fstab"))
generator = FstabGenerator(partitions,
root_mount_point,
mount_options,