diff --git a/cloudbaseinit/tests/utils/windows/test_vfat.py b/cloudbaseinit/tests/utils/windows/test_vfat.py index 2036e893..d0d821fb 100644 --- a/cloudbaseinit/tests/utils/windows/test_vfat.py +++ b/cloudbaseinit/tests/utils/windows/test_vfat.py @@ -52,11 +52,14 @@ class TestVfat(unittest.TestCase): self.assertEqual(expected_response, response) def test_is_vfat_drive_fails(self): + test_stderr = b"test stderr" + expected_logging = [ "Could not retrieve label for VFAT drive path %r" - % mock.sentinel.drive, + % (mock.sentinel.drive), + "mlabel failed with error %r" % test_stderr, ] - execute_process_value = (None, None, 1) + execute_process_value = (None, test_stderr, 1) expected_response = False self._test_is_vfat_drive(execute_process_value=execute_process_value, diff --git a/cloudbaseinit/utils/windows/vfat.py b/cloudbaseinit/utils/windows/vfat.py index 86ecbaa5..c9fac8d7 100644 --- a/cloudbaseinit/utils/windows/vfat.py +++ b/cloudbaseinit/utils/windows/vfat.py @@ -47,10 +47,11 @@ def is_vfat_drive(osutils, drive_path): mlabel = os.path.join(CONF.mtools_path, "mlabel.exe") args = [mlabel, "-i", drive_path, "-s"] - out, _, exit_code = osutils.execute_process(args, shell=False) + out, err, exit_code = osutils.execute_process(args, shell=False) if exit_code: LOG.warning("Could not retrieve label for VFAT drive path %r", drive_path) + LOG.warning("mlabel failed with error %r", err) return False out = out.decode().strip()