chiark / gitweb /
(Python): Use more modern `raise' syntax.
[tripe] / svc / conntrack.in
index 95a46867602b6105ff99acdb39cf18c24d12056f..3368295a46ec8d743dee349a503243dcca6b55ac 100644 (file)
@@ -211,7 +211,7 @@ def cmd_showgroup(g):
       pats = p
       break
   else:
-    raise T.TripeJobError, 'unknown-group', g
+    raise T.TripeJobError('unknown-group', g)
   for t, p, a, m in pats:
     T.svcinfo('peer', t,
               'target', p or '(default)',
@@ -321,7 +321,7 @@ def kickpeers():
       if want is not None and not found:
         def _(want = want):
           try:
-            SM.svcsubmit('connect', 'active', want)
+            list(SM.svcsubmit('connect', 'active', want))
           except T.TripeError, exc:
             SM.warn('conntrack', 'connect-failed', want, *exc.args)
         if T._debug: print '#   peer %s: bring up' % want
@@ -344,6 +344,8 @@ def netupdown(upness, reason):
 ###--------------------------------------------------------------------------
 ### NetworkManager monitor.
 
+DBPROPS_IFACE = 'org.freedesktop.DBus.Properties'
+
 NM_NAME = 'org.freedesktop.NetworkManager'
 NM_PATH = '/org/freedesktop/NetworkManager'
 NM_IFACE = NM_NAME
@@ -375,13 +377,13 @@ class NetworkManagerMonitor (object):
   def attach(me, bus):
     try:
       nm = bus.get_object(NM_NAME, NM_PATH)
-      state = nm.Get(NM_IFACE, 'State')
+      state = nm.Get(NM_IFACE, 'State', dbus_interface = DBPROPS_IFACE)
       if state in NM_CONNSTATES:
         netupdown(True, ['nm', 'initially-connected'])
       else:
         netupdown(False, ['nm', 'initially-disconnected'])
-    except D.DBusException:
-      pass
+    except D.DBusException, e:
+      if T._debug: print '# exception attaching to network-manager: %s' % e
     bus.add_signal_receiver(me._nm_state, 'StateChanged',
                             NM_IFACE, NM_NAME, NM_PATH)
     bus.add_signal_receiver(me._nm_connchange, 'PropertiesChanged',
@@ -420,8 +422,8 @@ class ConnManMonitor (object):
       props = cm.GetProperties(dbus_interface = CM_IFACE)
       state = props['State']
       netupdown(state == 'online', ['connman', 'initially-%s' % state])
-    except D.DBusException:
-      pass
+    except D.DBusException, e:
+      if T._debug: print '# exception attaching to connman: %s' % e
     bus.add_signal_receiver(me._cm_state, 'PropertyChanged',
                             CM_IFACE, CM_NAME, CM_PATH)
 
@@ -459,7 +461,8 @@ class MaemoICdMonitor (object):
       except D.DBusException:
         me._iap = None
         netupdown(False, ['icd', 'initially-disconnected'])
-    except D.DBusException:
+    except D.DBusException, e:
+      if T._debug: print '# exception attaching to icd: %s' % e
       me._iap = None
     bus.add_signal_receiver(me._icd_state, 'status_changed', ICD_IFACE,
                             ICD_NAME, ICD_PATH)