mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
storage: Fix regression with showing error messages
In ed09028fcd, when eject was made to run as
superuser inside storage action, parsing of the error messages was not handled
properly. Fix it to show simple error messages about why the eject was not
successful.
Tests performed:
- In a terminal, switch to the directory where a disk is mounted to keep the
mount point busy. Attempt to eject the disk. A large stack trace is shown
without the patch and a clean error message is shown with it.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
225d86e344
commit
955dfea866
3 files changed
+50
-47
No files matched your search
+6
-2
@@ -259,8 +259,12 @@ def subcommand_mount(arguments):
|
||||
def subcommand_eject(arguments):
|
||||
"""Eject a device by its path."""
|
||||
device_path = arguments.device
|
||||
drive = eject_drive_of_device(device_path)
|
||||
print(json.dumps(drive))
|
||||
try:
|
||||
drive = eject_drive_of_device(device_path)
|
||||
print(json.dumps(drive))
|
||||
except Exception as exception:
|
||||
print(exception, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def _get_options():
|
||||
|
||||
Reference in new issue
Block a user