Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Show a message when no superblock is recognised.

Better than a backtrace.
  • Loading branch information...
commit 751a5be549546c895fe97a8f07958ed22d1a7b08 1 parent 87c2b98
@g2p authored
Showing with 13 additions and 6 deletions.
  1. +13 −6 blocks/__main__.py
View
19 blocks/__main__.py
@@ -124,9 +124,13 @@ def ptable_type(self):
@memoized_property
def superblock_type(self):
- return subprocess.check_output(
- 'blkid -o value -s TYPE --'.split() + [self.devpath]
- ).rstrip().decode('ascii')
+ try:
+ return subprocess.check_output(
+ 'blkid -o value -s TYPE --'.split() + [self.devpath]
+ ).rstrip().decode('ascii')
+ except subprocess.CalledProcessError as err:
+ # No recognised superblock
+ assert err.returncode == 2, err
@memoized_property
def has_bcache_superblock(self):
@@ -749,9 +753,12 @@ def get_block_stack(device, progress):
stack.append(XFS(device))
else:
err = UnsupportedSuperblock(device=device)
- progress.notify_error(
- 'Unsupported superblock type: {}'
- .format(err.device.superblock_type), err)
+ if device.superblock_type is None:
+ progress.notify_error('Unrecognised superblock', err)
+ else:
+ progress.notify_error(
+ 'Unsupported superblock type: {}'
+ .format(err.device.superblock_type), err)
raise err
# only reached when we ended on a filesystem
Please sign in to comment.
Something went wrong with that request. Please try again.