diff options
author | Mina Galić <me+git@igalic.co> | 2020-11-02 18:01:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 12:01:41 -0500 |
commit | 34f8e2213c42106b3e1568b5c5aac5565df954e3 (patch) | |
tree | 87c2ddea1981ecfc36b1cf12441a0f7ccbbdaf84 /cloudinit/util.py | |
parent | 815a790cafc4e78edc5a2b631396d7fedb424bcf (diff) | |
download | vyos-cloud-init-34f8e2213c42106b3e1568b5c5aac5565df954e3.tar.gz vyos-cloud-init-34f8e2213c42106b3e1568b5c5aac5565df954e3.zip |
util: fix mounting of vfat on *BSD (#637)
Fix mounting of vfat filesystems by normalizing the different names for
vfat to "msdos" which works across BSDs.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index 83727544..b8856af1 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -418,6 +418,11 @@ def multi_log(text, console=True, stderr=True, @lru_cache() +def is_Linux(): + return 'Linux' in platform.system() + + +@lru_cache() def is_BSD(): return 'BSD' in platform.system() @@ -1661,16 +1666,17 @@ def mount_cb(device, callback, data=None, mtype=None, _type=type(mtype))) # clean up 'mtype' input a bit based on platform. - platsys = platform.system().lower() - if platsys == "linux": + if is_Linux(): if mtypes is None: mtypes = ["auto"] - elif platsys.endswith("bsd"): + elif is_BSD(): if mtypes is None: - mtypes = ['ufs', 'cd9660', 'vfat'] + mtypes = ['ufs', 'cd9660', 'msdos'] for index, mtype in enumerate(mtypes): if mtype == "iso9660": mtypes[index] = "cd9660" + if mtype in ["vfat", "msdosfs"]: + mtypes[index] = "msdos" else: # we cannot do a smart "auto", so just call 'mount' once with no -t mtypes = [''] |