mirror of
https://github.com/home-assistant/supervisor
synced 2024-10-02 06:19:58 +02:00
Ignore disappearing network devices while querying them (#3249)
Sometimes NetworkManager network devices disappear while we are query them. Presumably those are network interfaces generated by Docker. Skip them and print a warning.
This commit is contained in:
parent
e5817e9445
commit
d2b706df05
@ -13,6 +13,7 @@ from ...exceptions import (
|
||||
DBusError,
|
||||
DBusFatalError,
|
||||
DBusInterfaceError,
|
||||
DBusInterfaceMethodError,
|
||||
HostNotSupportedError,
|
||||
)
|
||||
from ...utils.dbus import DBus
|
||||
@ -162,7 +163,10 @@ class NetworkManager(DBusInterface):
|
||||
# Connect to interface
|
||||
try:
|
||||
await interface.connect()
|
||||
except DBusFatalError as err:
|
||||
except (DBusFatalError, DBusInterfaceMethodError) as err:
|
||||
# Docker creates and deletes interfaces quite often, sometimes
|
||||
# this causes a race condition: A device disappears while we
|
||||
# try to query it. Ignore those cases.
|
||||
_LOGGER.warning("Can't process %s: %s", device, err)
|
||||
continue
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
|
@ -162,11 +162,10 @@ class DBus:
|
||||
)
|
||||
|
||||
if reply.message_type == MessageType.ERROR:
|
||||
if reply.error_name in (
|
||||
"org.freedesktop.DBus.Error.ServiceUnknown",
|
||||
"org.freedesktop.DBus.Error.UnknownMethod",
|
||||
):
|
||||
if reply.error_name == "org.freedesktop.DBus.Error.ServiceUnknown":
|
||||
raise DBusInterfaceError(reply.body[0])
|
||||
if reply.error_name == "org.freedesktop.DBus.Error.UnknownMethod":
|
||||
raise DBusInterfaceMethodError(reply.body[0])
|
||||
if reply.error_name == "org.freedesktop.DBus.Error.Disconnected":
|
||||
raise DBusNotConnectedError()
|
||||
if reply.body and len(reply.body) > 0:
|
||||
|
Loading…
Reference in New Issue
Block a user