Skip to content

Commit ade196c

Browse files
committed
don't except on failing to resolve any blkid info, only fail when that
specific device was queried Signed-off-by: Zen <[email protected]>
1 parent f2cced4 commit ade196c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/ugrd/fs/mounts.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = 'desultory'
2-
__version__ = '4.9.2'
2+
__version__ = '4.10.0'
33

44
from pathlib import Path
55
from zenlib.util import contains, pretty_print
@@ -219,16 +219,18 @@ def get_blkid_info(self, device=None) -> str:
219219
raise ValueError("Unable to get blkid info.")
220220

221221
for device_info in blkid_output.split('\n'):
222-
device, info = device_info.split(': ')
222+
dev, info = device_info.split(': ')
223223
info = ' ' + info # Add space to make regex consistent
224-
self['_blkid_info'][device] = {}
225-
self.logger.debug("[%s] Processing blkid line: %s" % (device, info))
224+
self['_blkid_info'][dev] = {}
225+
self.logger.debug("[%s] Processing blkid line: %s" % (dev, info))
226226
for field in BLKID_FIELDS:
227227
if match := search(f' {field.upper()}="(.+?)"', info):
228-
self['_blkid_info'][device][field] = match.group(1)
228+
self['_blkid_info'][dev][field] = match.group(1)
229+
else:
230+
self.logger.warning("[%s] Failed to parse blkid field: %s" % (dev, field))
229231

230-
if not self['_blkid_info'][device]:
231-
raise ValueError("[%s] Failed to parse blkid info: %s" % (device, info))
232+
if device and not self['_blkid_info'][device]:
233+
raise ValueError("[%s] Failed to parse blkid info: %s" % (device, info))
232234

233235
self.logger.debug("Blkid info: %s" % pretty_print(self['_blkid_info']))
234236

0 commit comments

Comments
 (0)