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.
This commit is contained in:
parent
7d0874e23b
commit
d2dd4fd76b
@ -41,8 +41,13 @@ def run():
|
|||||||
"""
|
"""
|
||||||
Setup network configuration
|
Setup network configuration
|
||||||
"""
|
"""
|
||||||
|
|
||||||
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
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/"
|
source_nm = "/etc/NetworkManager/system-connections/"
|
||||||
target_nm = os.path.join(
|
target_nm = os.path.join(
|
||||||
root_mount_point, "etc/NetworkManager/system-connections/"
|
root_mount_point, "etc/NetworkManager/system-connections/"
|
||||||
|
@ -73,6 +73,15 @@ def run():
|
|||||||
dmcrypt_conf_path = libcalamares.job.configuration["configFilePath"]
|
dmcrypt_conf_path = libcalamares.job.configuration["configFilePath"]
|
||||||
partitions = libcalamares.globalstorage.value("partitions")
|
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('/')
|
dmcrypt_conf_path = dmcrypt_conf_path.lstrip('/')
|
||||||
|
|
||||||
return write_dmcrypt_conf(partitions, root_mount_point, dmcrypt_conf_path)
|
return write_dmcrypt_conf(partitions, root_mount_point, dmcrypt_conf_path)
|
||||||
|
@ -166,6 +166,11 @@ def run():
|
|||||||
filesystems = list()
|
filesystems = list()
|
||||||
partitions = libcalamares.globalstorage.value("partitions")
|
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:
|
for partition in partitions:
|
||||||
if partition["mountPoint"]:
|
if partition["mountPoint"]:
|
||||||
for src in libcalamares.job.configuration["targets"]:
|
for src in libcalamares.job.configuration["targets"]:
|
||||||
|
Loading…
Reference in New Issue
Block a user