From f2c2863f09bbd6fe10f9f901ffefdc50de5b3598 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 16 Jan 2022 18:43:50 +0200 Subject: fix: if debootstrap target is exists, it must be an empty dir Sponsored-by: author --- vmdb/plugins/debootstrap_plugin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py index 3bfeff9..a951591 100644 --- a/vmdb/plugins/debootstrap_plugin.py +++ b/vmdb/plugins/debootstrap_plugin.py @@ -59,6 +59,12 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): if not (suite and tag and target and mirror): raise Exception("missing arg for debootstrap step") + if os.path.exists(target): + if len(os.listdir(target)) > 0: + raise Exception( + f"debootstrap target is a non-empty directory: {target}" + ) + cmd = [ "debootstrap", "--arch", @@ -103,4 +109,3 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): ] + remove_pkgs, ) - -- cgit v1.2.1