summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-01-16 18:43:50 +0200
committerLars Wirzenius <liw@liw.fi>2022-01-16 18:43:50 +0200
commitf2c2863f09bbd6fe10f9f901ffefdc50de5b3598 (patch)
treefe0e5409075952ca6e4add8fad7080ad1412aed2
parent9abd69e9126b9cb3cba84eaadb9396bfc16f8eca (diff)
downloadvmdb2-f2c2863f09bbd6fe10f9f901ffefdc50de5b3598.tar.gz
fix: if debootstrap target is exists, it must be an empty dir
Sponsored-by: author
-rw-r--r--vmdb/plugins/debootstrap_plugin.py7
1 files changed, 6 insertions, 1 deletions
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,
)
-