Skip to content

Commit 209aa59

Browse files
committed
improved error messages/handling
Signed-off-by: Zen <[email protected]>
1 parent b60d6bc commit 209aa59

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ugrd/fs/btrfs.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def _validate_root_subvol(self) -> None:
3333
detected_subvol = _get_mount_subvol(self, '/')
3434
except SubvolNotFound:
3535
raise ValueError("Current root mount is not using a subvolume, but root_subvol is set: %s" % self['root_subvol'])
36+
except SubvolIsRoot:
37+
raise ValueError("Current root mount is not using a subvolume, but root_subvol is set: %s" % self['root_subvol'])
38+
3639
if self['root_subvol'] != detected_subvol:
3740
raise ValueError("[%s] Root subvolume does not match detected subvolume: %s" % (self['root_subvol'], detected_subvol))
3841

@@ -60,9 +63,10 @@ def btrfs_scan(self) -> str:
6063
return "btrfs device scan"
6164

6265

63-
@check_dict('root_subvol', unset=True, log_level=30, message="root_subvol is set, skipping")
64-
@check_dict('subvol_selector', value=False, log_level=20, message="subvol_selector enabled, skipping")
65-
@check_dict('autodetect_root_subvol', value=True, message="autodetect_root_subvol not enabled, skipping")
66+
@check_dict('root_subvol', unset=True, log_level=30, message="root_subvol is set, skipping.")
67+
@check_dict('subvol_selector', value=False, log_level=20, message="subvol_selector enabled, skipping.")
68+
@check_dict('autodetect_root_subvol', value=True, message="autodetect_root_subvol not enabled, skipping.")
69+
@check_dict('hostonly', value=True, message="hostonly is not set, skipping.")
6670
def autodetect_root_subvol(self):
6771
""" Detects the root subvolume. """
6872
try:

0 commit comments

Comments
 (0)