summaryrefslogtreecommitdiff
path: root/bin
diff options
authorJonathan Cave <jonathan.cave@canonical.com>2019-10-04 17:24:08 +0100
committerJonathan Cave <jonathan.cave@canonical.com>2019-10-08 17:22:29 +0100
commit3cacb219d0545f8e7472d9b83c0c6e28ab301904 (patch)
treed426379a8146115eddb3bc687c0495714ff6129f /bin
parent6ed2fdaabeda2229301570d908729b460f3c6035 (diff)
storage_test.py: error msg if no partitions
Diffstat (limited to 'bin')
-rwxr-xr-xbin/storage_test.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/bin/storage_test.py b/bin/storage_test.py
index 3dbc87f8..dbc0552c 100755
--- a/bin/storage_test.py
+++ b/bin/storage_test.py
@@ -31,6 +31,9 @@ def find_largest_partition(device):
blk_devs = [BlkDev(*p.strip().split())
for p in out.decode(sys.stdout.encoding).splitlines()]
blk_devs[:] = [bd for bd in blk_devs if bd.type == 'part']
+ if not blk_devs:
+ raise SystemExit(
+ 'ERROR: No partitions found on device {}'.format(device))
blk_devs.sort(key=lambda bd: int(bd.size))
return blk_devs[-1].name