1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-10 07:44:19 +01:00

Try to recover if we attempt to load a non-existent backend.

This commit is contained in:
Dan O'Reilly
2009-05-24 17:11:14 -04:00
parent 0408be848e
commit 1ee51fb747

View File

@@ -203,6 +203,16 @@ class WicdDaemon(dbus.service.Object):
def SetBackend(self, backend):
""" Sets a new backend. """
print "setting backend to %s" % backend
backends = networking.BACKEND_MGR.get_available_backends()
if backend not in backends:
print "backend %s not available, trying to fallback to another" % backend
try:
backend = backends[0]
except IndexError:
print "ERROR: no backends available!"
return
else:
print "Fell back to backend %s" % backend
self.config.set("Settings", "backend", backend, write=True)
if backend != self.GetCurrentBackend():
self.suspended = True