summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-02-12 09:44:28 -0500
committerScott Moser <smoser@ubuntu.com>2015-02-12 09:44:28 -0500
commitdcd1590469f7ad1806d1e94abe1badd51edce7ac (patch)
tree6eb3a53d448eeb603224aec2c628d9a911b8fc21
parent35dd98c07bce490e85e03bef872cbbf1185e0be9 (diff)
downloadvyos-cloud-init-dcd1590469f7ad1806d1e94abe1badd51edce7ac.tar.gz
vyos-cloud-init-dcd1590469f7ad1806d1e94abe1badd51edce7ac.zip
mount_cb: fix scoping of an exception in python3
-rw-r--r--cloudinit/util.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 67ea5553..4fbdf0a9 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1453,6 +1453,7 @@ def mount_cb(device, callback, data=None, rw=False, mtype=None, sync=True):
if device in mounted:
mountpoint = mounted[device]['mountpoint']
else:
+ failure_reason = None
for mtype in mtypes:
mountpoint = None
try:
@@ -1479,10 +1480,10 @@ def mount_cb(device, callback, data=None, rw=False, mtype=None, sync=True):
except (IOError, OSError) as exc:
LOG.debug("Failed mount of '%s' as '%s': %s",
device, mtype, exc)
- pass
+ failure_reason = exc
if not mountpoint:
raise MountFailedError("Failed mounting %s to %s due to: %s" %
- (device, tmpd, exc))
+ (device, tmpd, failure_reason))
# Be nice and ensure it ends with a slash
if not mountpoint.endswith("/"):