From 3b62ed4e4f60d4621256817b29aaf4a6a2540991 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Mon, 19 Jun 2023 19:29:02 -0400 Subject: [PATCH] dbus_manager: fix polkit warning Only warn that polkit is unavailable when a component attempts to use it to check a permission. Signed-off-by: Eric Callahan --- moonraker/components/dbus_manager.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/moonraker/components/dbus_manager.py b/moonraker/components/dbus_manager.py index 96cc484..b26df89 100644 --- a/moonraker/components/dbus_manager.py +++ b/moonraker/components/dbus_manager.py @@ -67,15 +67,18 @@ class DbusManager: "/org/freedesktop/PolicyKit1/Authority", "org.freedesktop.PolicyKit1.Authority") except self.DbusError: - self.server.add_warning( - "Unable to find DBus PolKit Interface, this suggests PolKit " - "is not installed on your OS.") + self.polkit = None async def check_permission(self, action: str, err_msg: str = "" ) -> bool: if self.polkit is None: + self.server.add_warning( + "Unable to find DBus PolKit Interface, this suggests PolKit " + "is not installed on your OS.", + "dbus_polkit" + ) return False try: ret = await self.polkit.call_check_authorization( # type: ignore