From 68e710207900ff8d933da6f79adc84bce980685d Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 16 Jun 2012 12:02:21 -0700 Subject: Correct the mount options to use a comma separated list for the mount options (if any provided/selected) --- cloudinit/util.py | 15 +++++++++++---- 1 file 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) -- cgit v1.2.3