Provide more debugging info for obtaining the VFAT drive label
This patch logs whatever mlabel returns. This can help us to debug situations where the output is actually different that what it is expected, which can lead to a is_vfat_drive to fail on a real VFAT Config Drive. Change-Id: I9fe6c19995b30335aeea2471164434b10626b004
This commit is contained in:
parent
4e7e8ac867
commit
df70ae91ca
@ -67,8 +67,12 @@ class TestVfat(unittest.TestCase):
|
|||||||
expected_response=expected_response)
|
expected_response=expected_response)
|
||||||
|
|
||||||
def test_is_vfat_drive_different_label(self):
|
def test_is_vfat_drive_different_label(self):
|
||||||
expected_logging = []
|
mock_out = b"Volume label is config"
|
||||||
execute_process_value = (b"Volume label is config", None, 0)
|
expected_logging = [
|
||||||
|
"Obtained label information for drive %r: %r"
|
||||||
|
% (mock.sentinel.drive, mock_out)
|
||||||
|
]
|
||||||
|
execute_process_value = (mock_out, None, 0)
|
||||||
expected_response = False
|
expected_response = False
|
||||||
|
|
||||||
self._test_is_vfat_drive(execute_process_value=execute_process_value,
|
self._test_is_vfat_drive(execute_process_value=execute_process_value,
|
||||||
@ -76,8 +80,12 @@ class TestVfat(unittest.TestCase):
|
|||||||
expected_response=expected_response)
|
expected_response=expected_response)
|
||||||
|
|
||||||
def test_is_vfat_drive_works(self):
|
def test_is_vfat_drive_works(self):
|
||||||
expected_logging = []
|
mock_out = b"Volume label is config-2 \r\n"
|
||||||
execute_process_value = (b"Volume label is config-2 \r\n", None, 0)
|
expected_logging = [
|
||||||
|
"Obtained label information for drive %r: %r"
|
||||||
|
% (mock.sentinel.drive, mock_out)
|
||||||
|
]
|
||||||
|
execute_process_value = (mock_out, None, 0)
|
||||||
expected_response = True
|
expected_response = True
|
||||||
|
|
||||||
self._test_is_vfat_drive(execute_process_value=execute_process_value,
|
self._test_is_vfat_drive(execute_process_value=execute_process_value,
|
||||||
|
@ -54,6 +54,7 @@ def is_vfat_drive(osutils, drive_path):
|
|||||||
LOG.warning("mlabel failed with error %r", err)
|
LOG.warning("mlabel failed with error %r", err)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
LOG.info("Obtained label information for drive %r: %r", drive_path, out)
|
||||||
out = out.decode().strip()
|
out = out.decode().strip()
|
||||||
match = VOLUME_LABEL_REGEX.search(out)
|
match = VOLUME_LABEL_REGEX.search(out)
|
||||||
return match.group(1) == CONFIG_DRIVE_LABEL
|
return match.group(1) == CONFIG_DRIVE_LABEL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user