From dcd1590469f7ad1806d1e94abe1badd51edce7ac Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 12 Feb 2015 09:44:28 -0500 Subject: mount_cb: fix scoping of an exception in python3 --- cloudinit/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cloudinit/util.py') 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("/"): -- cgit v1.2.3