From 7856c1a6a8a0dd2ccc3618f92d867a7f94cd1ba3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 30 Sep 2019 16:27:57 +0200 Subject: [PATCH] [unpackfs] Do more checks before doing any work --- src/modules/unpackfs/main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py index 90c258cd7..940f9152a 100644 --- a/src/modules/unpackfs/main.py +++ b/src/modules/unpackfs/main.py @@ -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"),