Skip to content

Commit 23aa537

Browse files
committed
Match org.freedesktop.zbus.Error in error reporting
When using the zbus crate, zbus property error setting failures will always result in this error. Signed-off-by: mulhern <[email protected]>
1 parent ca0a8f3 commit 23aa537

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/stratis_cli/_error_reporting.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,19 @@ def _interpret_errors_2( # pylint: disable=too-many-return-statements
283283
next_error = errors[1]
284284
if isinstance(next_error, dbus.exceptions.DBusException):
285285
dbus_name = next_error.get_dbus_name()
286+
context = error.context
287+
288+
if dbus_name == "org.freedesktop.zbus.Error" and isinstance(
289+
context, DPClientSetPropertyContext
290+
):
291+
return (
292+
f"stratisd failed to perform the operation that you "
293+
f"requested, because it could not set the D-Bus "
294+
f'property "{context.property_name}" belonging to '
295+
f'interface "{error.interface_name}" to "{context.value}". '
296+
f"It returned the following error: "
297+
f"{next_error.get_dbus_message()}."
298+
)
286299

287300
# We do not test this error, as the only known way to cause it is
288301
# manipulation of selinux configuration, which is too laborious to
@@ -297,7 +310,6 @@ def _interpret_errors_2( # pylint: disable=too-many-return-statements
297310
)
298311

299312
if dbus_name == "org.freedesktop.DBus.Error.Failed":
300-
context = error.context
301313

302314
# We do not test this error, as the only known way to cause it
303315
# is to spam the daemon with a succession of mutating commands

0 commit comments

Comments
 (0)