[elbe-devel] [PATCH 2/8] elbepack: hdimg.py: adding exception handling
Thomas Weißschuh
t-8ch at linutronix.de
Tue Apr 2 08:39:23 CEST 2024
On Thu, Mar 28, 2024 at 02:41:03PM +0100, Eduard Krein wrote:
> Adding exception handling to check if directories can
> be created on build target.
>
> Signed-off-by: Eduard Krein <eduard.krein at linutronix.de>
> ---
> elbepack/hdimg.py | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
> index 1f1e9357..0a83fa5c 100644
> --- a/elbepack/hdimg.py
> +++ b/elbepack/hdimg.py
> @@ -363,7 +363,9 @@ def create_label(disk, part, ppart, fslabel, target, grub):
> do(
> f'cp -a "{os.path.join(target, "filesystems", entry.id)}/." '
> f'"{mount_path}/"',
> - allow_fail=True)
> + allow_fail=False)
> + except Exception as E:
> + logging.error('Filesystem copy command failed: %s', E)
While this will log the error, the build will still continue.
How about just allow_fail=False and let the exception do its job,
aborting the build?
> finally:
> do(f'umount {loopdev}')
> finally:
> --
> 2.39.2
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
More information about the elbe-devel
mailing list