diff options
Diffstat (limited to 'vmdb/plugins/unpack_rootfs_plugin.py')
-rw-r--r-- | vmdb/plugins/unpack_rootfs_plugin.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vmdb/plugins/unpack_rootfs_plugin.py b/vmdb/plugins/unpack_rootfs_plugin.py index ec0ae6a..fb0945a 100644 --- a/vmdb/plugins/unpack_rootfs_plugin.py +++ b/vmdb/plugins/unpack_rootfs_plugin.py @@ -45,5 +45,10 @@ class UnpackCacheStepRunner(vmdb.StepRunnerInterface): state.rootfs_unpacked = True def copy_resolv_conf(self, rootdir): - filename = os.path.join(rootdir, "etc", "resolv.conf") + # handle the case where /etc/resolv.conf is a symlink on the target + # (which is the case for many modern Linuxes) by copying the host file + # to the target of the symlink in the chroot + filename = os.path.realpath(os.path.join(rootdir, "etc", "resolv.conf")) + target_dir = os.path.dirname(filename) + os.makedirs(target_dir, exist_ok=True) vmdb.runcmd(["cp", "/etc/resolv.conf", filename]) |