summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-02-10 09:05:09 +0200
committerLars Wirzenius <liw@liw.fi>2022-02-10 07:27:52 +0000
commit7d8565d872fc3d1e56fb344e65b53de09088be59 (patch)
tree5c982dfc6f21f5455158d09f1416d656a490dece
parent436464ed23f63e5daa025f844e6a7caaf5bc17b6 (diff)
downloadvmdb2-7d8565d872fc3d1e56fb344e65b53de09088be59.tar.gz
fix: test suite after debootstrap-target-must-be-empty change
Now allow lost+found in target. Sponsored-by: author
-rw-r--r--smoke-pc.vmdb34
-rw-r--r--vmdb/plugins/debootstrap_plugin.py6
2 files changed, 21 insertions, 19 deletions
diff --git a/smoke-pc.vmdb b/smoke-pc.vmdb
index 62fe20b..d7aadeb 100644
--- a/smoke-pc.vmdb
+++ b/smoke-pc.vmdb
@@ -25,23 +25,6 @@ steps:
- mount: rootfs
- - create-dir: /smoke-dir
- perm: 0777
- uid: 1000
- gid: 1000
-
- - create-file: /smoke-create-file.txt
- contents: No smoke here.
- perm: 0777
- uid: 1000
- gid: 1000
-
- - copy-file: /smoke-copy-file.txt
- src: smoke-copy-file.txt
- perm: 0777
- uid: 1000
- gid: 1000
-
- unpack-rootfs: rootfs
- debootstrap: buster
@@ -59,6 +42,23 @@ steps:
- cache-rootfs: rootfs
unless: rootfs_unpacked
+ - create-dir: /smoke-dir
+ perm: 0777
+ uid: 1000
+ gid: 1000
+
+ - create-file: /smoke-create-file.txt
+ contents: No smoke here.
+ perm: 0777
+ uid: 1000
+ gid: 1000
+
+ - copy-file: /smoke-copy-file.txt
+ src: smoke-copy-file.txt
+ perm: 0777
+ uid: 1000
+ gid: 1000
+
- chroot: rootfs
shell: |
sed -i '/^root:[^:]*:/s//root::/' /etc/passwd
diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py
index a951591..f7404c1 100644
--- a/vmdb/plugins/debootstrap_plugin.py
+++ b/vmdb/plugins/debootstrap_plugin.py
@@ -60,9 +60,11 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface):
raise Exception("missing arg for debootstrap step")
if os.path.exists(target):
- if len(os.listdir(target)) > 0:
+ allowed_names = ["lost+found"]
+ names = [n for n in os.listdir(target) if n not in allowed_names]
+ if len(names) > 0:
raise Exception(
- f"debootstrap target is a non-empty directory: {target}"
+ f"debootstrap target {target} is a not an empty directory: {names}"
)
cmd = [