mirror of
https://github.com/gryf/wicd.git
synced 2026-03-15 06:03:40 +01:00
Try to recover if we attempt to load a non-existent backend.
This commit is contained in:
@@ -203,6 +203,16 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
def SetBackend(self, backend):
|
def SetBackend(self, backend):
|
||||||
""" Sets a new backend. """
|
""" Sets a new backend. """
|
||||||
print "setting backend to %s" % 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)
|
self.config.set("Settings", "backend", backend, write=True)
|
||||||
if backend != self.GetCurrentBackend():
|
if backend != self.GetCurrentBackend():
|
||||||
self.suspended = True
|
self.suspended = True
|
||||||
|
|||||||
Reference in New Issue
Block a user