Skip to content

Commit 520fa7a

Browse files
committed
Use an indentifer for a the dbus error name
Signed-off-by: mulhern <[email protected]>
1 parent adf7744 commit 520fa7a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/stratis_cli/_error_reporting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ def _interpret_errors_0(
112112
:rtype: None or str
113113
"""
114114

115+
dbus_name = error.get_dbus_name()
116+
115117
# The permissions with which stratis-cli makes requests on the D-Bus
116118
# are controlled by the "stratisd.conf" file. The CLI tests do not
117119
# control the contents or installation of "stratisd.conf"
118120
# and therefore, we cannot test this case reliably.
119-
if (
120-
error.get_dbus_name() == "org.freedesktop.DBus.Error.AccessDenied"
121-
): # pragma: no cover
121+
if dbus_name == "org.freedesktop.DBus.Error.AccessDenied": # pragma: no cover
122122
return (
123123
"Most likely stratis has insufficient permissions for the action requested."
124124
)
@@ -129,7 +129,7 @@ def _interpret_errors_0(
129129
# running with a new major version and is supplying a different name on the
130130
# D-Bus than stratis is attempting to use. The second and third
131131
# possibilities are both covered by a single error message.
132-
if error.get_dbus_name() in (
132+
if dbus_name in (
133133
"org.freedesktop.DBus.Error.NameHasNoOwner",
134134
"org.freedesktop.DBus.Error.ServiceUnknown",
135135
):

0 commit comments

Comments
 (0)