I think you might be able to not change anything in the get_mount_info path, but rather just fix a bug in 'parse_mount(path)'.
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -2056,6 +2056,8 @@ def parse_mount(path):
mount_locs = mountoutput.splitlines()
for line in mount_locs:
m = re.search(r'^(/dev/[\S]+) on (/.*) \((.+), .+, (.+)\)$', line)
+ if not m:
+ continue
devpth = m.group(1) mount_point = m.group(2)
fs_type = m.group(3)
then, in my testing on a freebsd instance in digital ocean :
$ python -c 'from cloudinit import util; print(util.get_mount_info("/"))'
('/dev/gpt/rootfs', 'ufs', '/')
Actually, even without the change it works for me with 'mount' output like:
$ mount
/dev/gpt/rootfs on / (ufs, local, soft-updates)
devfs on /dev (devfs, local, multilabel)
fdescfs on /dev/fd (fdescfs)
/dev/vtbd1 on /var/lib/cloud/seed/config_drive (cd9660, local, read-only)
Note, that it does not work unless you give it a mount point as input. Ie, util.get_mount_info("/etc") will not work while it does work on linux. We could fix that though, by just looking through all the mount points and finding the one that 'path' is on.
I think you might be able to not change anything in the get_mount_info path, but rather just fix a bug in 'parse_ mount(path) '.
--- a/cloudinit/util.py splitlines( ) r'^(/dev/ [\S]+) on (/.*) \((.+), .+, (.+)\)$', line)
mount_ point = m.group(2)
+++ b/cloudinit/util.py
@@ -2056,6 +2056,8 @@ def parse_mount(path):
mount_locs = mountoutput.
for line in mount_locs:
m = re.search(
+ if not m:
+ continue
devpth = m.group(1)
fs_type = m.group(3)
then, in my testing on a freebsd instance in digital ocean : get_mount_ info("/ "))'
$ python -c 'from cloudinit import util; print(util.
('/dev/gpt/rootfs', 'ufs', '/')
Actually, even without the change it works for me with 'mount' output like: cloud/seed/ config_ drive (cd9660, local, read-only)
$ mount
/dev/gpt/rootfs on / (ufs, local, soft-updates)
devfs on /dev (devfs, local, multilabel)
fdescfs on /dev/fd (fdescfs)
/dev/vtbd1 on /var/lib/
Note, that it does not work unless you give it a mount point as input. Ie, util.get_ mount_info( "/etc") will not work while it does work on linux. We could fix that though, by just looking through all the mount points and finding the one that 'path' is on.