From 7d0874e23b439aa1c873da0092a5778e701e5efc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 28 Apr 2019 14:32:27 -0400 Subject: [PATCH] [mount] Bail on bad config - One might argue whether an empty list of partitions to mount is a bad thing. It suggests that the partition module wasn't used, and so we're in an OEM situation -- but then everything should already be mounted anyway. That's why I choose empty -> bail. --- src/modules/mount/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index 50b74b844..aab3568d1 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -133,9 +133,15 @@ def run(): :return: """ - root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") partitions = libcalamares.globalstorage.value("partitions") + if not partitions: + libcalamares.utils.warning("partitions is empty, {!s}".format(partitions)) + return (_("Configuration Error"), + _("No partitions are defined for
{!s}
to use." ).format("mount")) + + root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") + # 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 []