diff options
author | Ksenija Stanojevic <KsenijaS@users.noreply.github.com> | 2023-05-09 14:21:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-09 16:21:50 -0500 |
commit | e07ad4a570c6588323bac0a5417167e4fd690b28 (patch) | |
tree | 3fbbc3f797a3d919e09e6863db643f09a9144f2b /cloudinit | |
parent | b1a14a2a3245743adb960d9ae8c859bf1172feb1 (diff) | |
download | cloud-init-git-e07ad4a570c6588323bac0a5417167e4fd690b28.tar.gz |
Remove mount NTFS error message (#2134)
Provide an option to suppress error logging from mount_cb as some
errors can be expected error and handled appropriately by
DataSources. For example: failure to mount NTFS volumes on VMs that
do not have NTFS drivers.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/sources/DataSourceAzure.py | 1 | ||||
-rw-r--r-- | cloudinit/util.py | 26 |
2 files changed, 17 insertions, 10 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index 923644e1..863a06b5 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -1596,6 +1596,7 @@ def can_dev_be_reformatted(devpath, preserve_ntfs): count_files, mtype="ntfs", update_env_for_mount={"LANG": "C"}, + log_error=False, ) except util.MountFailedError as e: evt.description = "cannot mount ntfs" 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( |