|
@@ -266,10 +266,15 @@ class Disk:
|
|
|
out = exec_cmd("%s -sm %s unit B print" % (self.parted, self.imagepath))
|
|
|
parttype = namedtuple("Part", "pnum start end size fstype")
|
|
|
splitted = out.splitlines()
|
|
|
- lsector_size, psector_size, self._ptable_format = splitted[1].split(":")[3:6]
|
|
|
+ # skip over possible errors in exec_cmd output
|
|
|
+ try:
|
|
|
+ idx =splitted.index("BYT;")
|
|
|
+ except ValueError:
|
|
|
+ raise WicError("Error getting partition information from %s" % (self.parted))
|
|
|
+ lsector_size, psector_size, self._ptable_format = splitted[idx + 1].split(":")[3:6]
|
|
|
self._lsector_size = int(lsector_size)
|
|
|
self._psector_size = int(psector_size)
|
|
|
- for line in splitted[2:]:
|
|
|
+ for line in splitted[idx + 2:]:
|
|
|
pnum, start, end, size, fstype = line.split(':')[:5]
|
|
|
partition = parttype(int(pnum), int(start[:-1]), int(end[:-1]),
|
|
|
int(size[:-1]), fstype)
|