summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-11-05 16:19:39 +0200
committerLars Wirzenius <liw@liw.fi>2023-11-05 16:28:18 +0200
commit706600a0d7c7fc488b427e2b72b8c300b97410f7 (patch)
treed0e1f7cd3e4b0d32f221b08c6e05b22dd859a5b6
parent96fa1ffcb7000db71c83b7ae74fd83a0025bd4c4 (diff)
downloadvmdb2-706600a0d7c7fc488b427e2b72b8c300b97410f7.tar.gz
fix: remove /etc/resolv.conf when the root file system is unmounted
debootstrap seems to create it, so that it can resolve DNS names in the chroot. However, we don't want it in the final image. Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
-rw-r--r--vmdb/plugins/mount_plugin.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/vmdb/plugins/mount_plugin.py b/vmdb/plugins/mount_plugin.py
index 30554b7..7a9faea 100644
--- a/vmdb/plugins/mount_plugin.py
+++ b/vmdb/plugins/mount_plugin.py
@@ -103,6 +103,10 @@ class MountStepRunner(vmdb.StepRunnerInterface):
if mount_point is None:
return
+ resolv_conf = os.path.join(mount_point, "etc/resolv.conf")
+ if os.path.exists(resolv_conf):
+ os.remove(resolv_conf)
+
try:
vmdb.unmount(mount_point)
except vmdb.NotMounted as e: