summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index b0d2ddb0..7651ae67 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1908,7 +1908,12 @@ def mounts():
def mount_cb(
- device, callback, data=None, mtype=None, update_env_for_mount=None
+ device,
+ callback,
+ data=None,
+ mtype=None,
+ update_env_for_mount=None,
+ log_error=True,
):
"""
Mount the device, call method 'callback' passing the directory
@@ -1968,15 +1973,16 @@ def mount_cb(
mountpoint = tmpd
break
except (IOError, OSError) as exc:
- LOG.debug(
- "Failed to mount device: '%s' with type: '%s' "
- "using mount command: '%s', "
- "which caused exception: %s",
- device,
- mtype,
- " ".join(mountcmd),
- exc,
- )
+ if log_error:
+ LOG.debug(
+ "Failed to mount device: '%s' with type: '%s' "
+ "using mount command: '%s', "
+ "which caused exception: %s",
+ device,
+ mtype,
+ " ".join(mountcmd),
+ exc,
+ )
failure_reason = exc
if not mountpoint:
raise MountFailedError(