Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/stratis_cli/_error_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,19 +282,21 @@ def _interpret_errors_2( # pylint: disable=too-many-return-statements
if len(errors) > 1:
next_error = errors[1]
if isinstance(next_error, dbus.exceptions.DBusException):
dbus_name = next_error.get_dbus_name()

# We do not test this error, as the only known way to cause it is
# manipulation of selinux configuration, which is too laborious to
# bother with at this time.
if (
next_error.get_dbus_name() == "org.freedesktop.DBus.Error.Disconnected"
dbus_name == "org.freedesktop.DBus.Error.Disconnected"
): # pragma: no cover
return (
"The D-Bus connection was disconnected during a "
"D-Bus interaction. Most likely, your selinux settings "
"prohibit that particular D-Bus interaction."
)

if next_error.get_dbus_name() == "org.freedesktop.DBus.Error.Failed":
if dbus_name == "org.freedesktop.DBus.Error.Failed":
context = error.context

# We do not test this error, as the only known way to cause it
Expand Down Expand Up @@ -339,7 +341,7 @@ def _interpret_errors_2( # pylint: disable=too-many-return-statements
f"{next_error.get_dbus_message()}."
)

if next_error.get_dbus_name() == "org.freedesktop.DBus.Error.NoReply":
if dbus_name == "org.freedesktop.DBus.Error.NoReply":
context = error.context
if (
error.interface_name == MANAGER_0_INTERFACE
Expand Down
Loading