diff options
author | rtkapiper <andy.piper@arcticwolf.com> | 2023-07-11 17:49:45 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-07-14 11:12:59 +0000 |
commit | db10875fe07da19641286f6ce398a8b55958ad80 (patch) | |
tree | 297a2482b0ee7f6c08bc95df8d89a5da896448b6 | |
parent | abc89a98ccd003d4baf01868637eff944d9a37d1 (diff) | |
download | vmdb2-db10875fe07da19641286f6ce398a8b55958ad80.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`
(the previous attempt to merge this accidentally deleted the for loop on
line 57...)
-rw-r--r-- | vmdb/plugins/mount_plugin.py | 7 | ||||
-rw-r--r-- | vmdb/plugins/virtualfs_plugin.py | 2 |
2 files changed, 5 insertions, 4 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..cddb8e7 100644 --- a/vmdb/plugins/virtualfs_plugin.py +++ b/vmdb/plugins/virtualfs_plugin.py @@ -55,7 +55,7 @@ class VirtualFilesystemMountStepRunner(vmdb.StepRunnerInterface): 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]) |