summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 12:02:21 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 12:02:21 -0700
commit68e710207900ff8d933da6f79adc84bce980685d (patch)
tree6e6656e0c94eb3623baa19d37b0a12ea380e4446 /cloudinit/util.py
parent1ddc33d3091d5518e29500d7db434d74182ce0f1 (diff)
downloadvyos-cloud-init-68e710207900ff8d933da6f79adc84bce980685d.tar.gz
vyos-cloud-init-68e710207900ff8d933da6f79adc84bce980685d.zip
Correct the mount options to use a comma separated list for the mount options (if any provided/selected)
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 6e8ce96e..38ca9573 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1090,7 +1090,7 @@ def mounts():
return mounted
-def mount_cb(device, callback, data=None, rw=False, mtype=None):
+def mount_cb(device, callback, data=None, rw=False, mtype=None, sync=True):
"""
Mount the device, call method 'callback' passing the directory
in which it was mounted, then unmount. Return whatever 'callback'
@@ -1103,11 +1103,18 @@ def mount_cb(device, callback, data=None, rw=False, mtype=None):
mountpoint = "%s/" % mounted[device]['mountpoint']
else:
try:
- mountcmd = ['mount', "-o"]
+ mountcmd = ['mount']
+ mountopts = []
if rw:
- mountcmd.append('rw')
+ mountopts.append('rw')
else:
- mountcmd.append('ro')
+ mountopts.append('ro')
+ if sync:
+ # This seems like the safe approach to do
+ # (where this is on by default)
+ mountopts.append("sync")
+ if mountopts:
+ mountcmd.extend(["-o", ",".join(mountopts)])
if mtype:
mountcmd.extend(['-t', mtype])
mountcmd.append(device)