diff options
author | rtkapiper <andy.piper@arcticwolf.com> | 2023-07-11 17:49:45 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-07-13 06:37:10 +0000 |
commit | 359a98beda8c105c2af831d665b0bf684604bad3 (patch) | |
tree | 9a68b4cf252577f3ec11c3aa6d44875b76d73b7a | |
parent | 680be98e8265644a3f5cd8001433482a549470cd (diff) | |
download | vmdb2-359a98beda8c105c2af831d665b0bf684604bad3.tar.gz |
mount_plugin virtualfs_plugin: normalize mountpoint paths
Normalizing mountpoint paths fixes a bug where vmdb2 incorrectly
determined that mountpoints were not mounted because the (un-normalized)
paths in the state object didn't match the (normalized) paths in
`/proc/mounts`
-rw-r--r-- | vmdb/plugins/mount_plugin.py | 7 | ||||
-rw-r--r-- | vmdb/plugins/virtualfs_plugin.py | 3 |
2 files changed, 5 insertions, 5 deletions
diff --git a/vmdb/plugins/mount_plugin.py b/vmdb/plugins/mount_plugin.py index 699ffc5..b8ebcb1 100644 --- a/vmdb/plugins/mount_plugin.py +++ b/vmdb/plugins/mount_plugin.py @@ -15,7 +15,6 @@ # # =*= License: GPL-3+ =*= - import logging import os import tempfile @@ -61,8 +60,10 @@ class MountStepRunner(vmdb.StepRunnerInterface): if not state.tags.has_tag(mount_on): raise Exception("cannot find tag {}".format(mount_on)) - mount_point = os.path.join( - state.tags.get_builder_mount_point(mount_on), "./" + dirname + mount_point = os.path.normpath( + os.path.join( + state.tags.get_builder_mount_point(mount_on), "./" + dirname + ) ) if not os.path.exists(mount_point): diff --git a/vmdb/plugins/virtualfs_plugin.py b/vmdb/plugins/virtualfs_plugin.py index 9f440f8..6416a12 100644 --- a/vmdb/plugins/virtualfs_plugin.py +++ b/vmdb/plugins/virtualfs_plugin.py @@ -54,8 +54,7 @@ class VirtualFilesystemMountStepRunner(vmdb.StepRunnerInterface): if not hasattr(state, "virtuals"): state.virtuals = [] - for device, mount_point, fstype in self.virtuals: - path = os.path.join(rootfs, "./" + mount_point) + path = os.path.normpath(os.path.join(rootfs, "./" + mount_point)) if not os.path.exists(path): os.mkdir(path) vmdb.runcmd(["mount", "-t", fstype, device, path]) |