summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorPaul Meyer <paulmey@microsoft.com>2018-05-23 15:45:39 -0400
committerScott Moser <smoser@brickies.net>2018-05-23 15:45:39 -0400
commitaa4eeb80839382117e1813e396dc53aa634fd7ba (patch)
tree570eb620d2a7936508c28ff9bdd493cc15dadacb /cloudinit/util.py
parent32c485bdc6e1eee0ad1d92dcd633a4e7ac9ac7a6 (diff)
downloadvyos-cloud-init-aa4eeb80839382117e1813e396dc53aa634fd7ba.tar.gz
vyos-cloud-init-aa4eeb80839382117e1813e396dc53aa634fd7ba.zip
Azure: Ignore NTFS mount errors when checking ephemeral drive
The Azure data source provides a method to check whether a NTFS partition on the ephemeral disk is safe for reformatting to ext4. The method checks to see if there are customer data files on the disk. However, mounting the partition fails on systems that do not have the capability of mounting NTFS. Note that in this case, it is also very unlikely that the NTFS partition would have been used by the system (since it can't mount it). The only case would be where an update to the system removed the capability to mount NTFS, the likelihood of which is also very small. This change allows the reformatting of the ephemeral disk to ext4 on systems where mounting NTFS is not supported.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index edfedc7d..653ed6ea 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1581,7 +1581,8 @@ def mounts():
return mounted
-def mount_cb(device, callback, data=None, rw=False, mtype=None, sync=True):
+def mount_cb(device, callback, data=None, rw=False, mtype=None, sync=True,
+ update_env_for_mount=None):
"""
Mount the device, call method 'callback' passing the directory
in which it was mounted, then unmount. Return whatever 'callback'
@@ -1643,7 +1644,7 @@ def mount_cb(device, callback, data=None, rw=False, mtype=None, sync=True):
mountcmd.extend(['-t', mtype])
mountcmd.append(device)
mountcmd.append(tmpd)
- subp(mountcmd)
+ subp(mountcmd, update_env=update_env_for_mount)
umount = tmpd # This forces it to be unmounted (when set)
mountpoint = tmpd
break