|
1 | 1 | __author__ = 'desultory' |
2 | | -__version__ = '4.9.2' |
| 2 | +__version__ = '4.10.0' |
3 | 3 |
|
4 | 4 | from pathlib import Path |
5 | 5 | from zenlib.util import contains, pretty_print |
@@ -219,16 +219,18 @@ def get_blkid_info(self, device=None) -> str: |
219 | 219 | raise ValueError("Unable to get blkid info.") |
220 | 220 |
|
221 | 221 | for device_info in blkid_output.split('\n'): |
222 | | - device, info = device_info.split(': ') |
| 222 | + dev, info = device_info.split(': ') |
223 | 223 | 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)) |
226 | 226 | for field in BLKID_FIELDS: |
227 | 227 | 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)) |
229 | 231 |
|
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)) |
232 | 234 |
|
233 | 235 | self.logger.debug("Blkid info: %s" % pretty_print(self['_blkid_info'])) |
234 | 236 |
|
|
0 commit comments