Modules: Improve error reporting

- Remaining modules [networkcfg] [openrcdmcryptcfg] [rawfs] with
   code that throws on bad configuration. Replace with meaningful
   error messages, to better check cases of SyntaxError &c.
main
Adriaan de Groot 6 years ago
parent 7d0874e23b
commit d2dd4fd76b

@ -41,8 +41,13 @@ def run():
"""
Setup network configuration
"""
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
if root_mount_point is None:
libcalamares.utils.warning("rootMountPoint is empty, {!s}".format(root_mount_point))
return (_("Configuration Error"),
_("No root mount point is given for <pre>{!s}</pre> to use." ).format("networkcfg"))
source_nm = "/etc/NetworkManager/system-connections/"
target_nm = os.path.join(
root_mount_point, "etc/NetworkManager/system-connections/"

@ -73,6 +73,15 @@ def run():
dmcrypt_conf_path = libcalamares.job.configuration["configFilePath"]
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 <pre>{!s}</pre> to use." ).format("openrcdmcryptcfg"))
if not root_mount_point:
libcalamares.utils.warning("rootMountPoint is empty, {!s}".format(root_mount_point))
return (_("Configuration Error"),
_("No root mount point is given for <pre>{!s}</pre> to use." ).format("openrcdmcryptcfg"))
dmcrypt_conf_path = dmcrypt_conf_path.lstrip('/')
return write_dmcrypt_conf(partitions, root_mount_point, dmcrypt_conf_path)

@ -166,6 +166,11 @@ def run():
filesystems = list()
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 <pre>{!s}</pre> to use." ).format("rawfs"))
for partition in partitions:
if partition["mountPoint"]:
for src in libcalamares.job.configuration["targets"]:

Loading…
Cancel
Save