[PATCH 1/3] Convert errors raised during dbus connection to DBusCallError

David Shea dshea at redhat.com
Wed Mar 19 18:04:53 UTC 2014


---
 pyanaconda/safe_dbus.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/safe_dbus.py b/pyanaconda/safe_dbus.py
index cf04c81..ecb6c15 100644
--- a/pyanaconda/safe_dbus.py
+++ b/pyanaconda/safe_dbus.py
@@ -70,11 +70,14 @@ def dbus_call_safe_sync(service, obj_path, iface, method, args,
     """
 
     if not connection:
-        connection = Gio.DBusConnection.new_for_address_sync(
-                       DBUS_SYSTEM_BUS_ADDR,
-                       Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT|
-                       Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION,
-                       None, None)
+        try:
+            connection = Gio.DBusConnection.new_for_address_sync(
+                           DBUS_SYSTEM_BUS_ADDR,
+                           Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT|
+                           Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION,
+                           None, None)
+        except GLib.GError as gerr:
+            raise DBusCallError("Unable to connect to system bus: %s", gerr)
 
     if connection.is_closed():
         raise DBusCallError("Connection is closed")
-- 
1.8.5.3



More information about the anaconda-patches mailing list