[unpackfs] Do more checks before doing any work

This commit is contained in:
Adriaan de Groot 2019-09-30 16:27:57 +02:00
parent 784bc5b86e
commit 7856c1a6a8

View File

@ -330,8 +330,7 @@ def run():
supported_filesystems = get_supported_filesystems()
unpack = list()
# Bail out before we start when there are obvious problems
for entry in job.configuration["unpack"]:
source = os.path.abspath(entry["source"])
sourcefs = entry["sourcefs"]
@ -340,14 +339,18 @@ def run():
utils.warning("The filesystem for \"{}\" ({}) is not supported".format(source, sourcefs))
return (_("Bad unsquash configuration"),
_("The filesystem for \"{}\" ({}) is not supported").format(source, sourcefs))
destination = os.path.abspath(root_mount_point + entry["destination"])
if not os.path.exists(source):
utils.warning("The source filesystem \"{}\" does not exist".format(source))
return (_("Bad unsquash configuration"),
_("The source filesystem \"{}\" does not exist").format(source))
unpack = list()
for entry in job.configuration["unpack"]:
source = os.path.abspath(entry["source"])
sourcefs = entry["sourcefs"]
destination = os.path.abspath(root_mount_point + entry["destination"])
if not os.path.isdir(destination):
utils.warning(("The destination \"{}\" in the target system is not a directory").format(destination))
return (_("Bad unsquash configuration"),