mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-19 07:06:30 +00:00
Fix error if a wlan scan is allready running (#2238)
* Fix error if a wlan scan is allready running * fix other messages too
This commit is contained in:
parent
c4847ad10d
commit
280d423bfe
@ -225,6 +225,10 @@ class DBusParseError(DBusError):
|
||||
"""DBus parse error."""
|
||||
|
||||
|
||||
class DBusProgramError(DBusError):
|
||||
"""DBus application error."""
|
||||
|
||||
|
||||
# util/apparmor
|
||||
|
||||
|
||||
|
@ -22,6 +22,7 @@ from ..dbus.payloads.generate import interface_update_payload
|
||||
from ..exceptions import (
|
||||
DBusError,
|
||||
DBusNotConnectedError,
|
||||
DBusProgramError,
|
||||
HostNetworkError,
|
||||
HostNetworkNotFound,
|
||||
HostNotSupportedError,
|
||||
@ -140,9 +141,19 @@ class NetworkManager(CoreSysAttributes):
|
||||
_LOGGER.error("Can only scan with wireless card - %s", interface.name)
|
||||
raise HostNotSupportedError()
|
||||
|
||||
# Request Scan
|
||||
try:
|
||||
await inet.wireless.request_scan()
|
||||
except DBusProgramError as err:
|
||||
if (
|
||||
"GDBus.Error:org.freedesktop.NetworkManager.Device.NotAllowed"
|
||||
not in str(err)
|
||||
):
|
||||
raise HostNetworkError() from err
|
||||
else:
|
||||
await asyncio.sleep(5)
|
||||
|
||||
# Process AP
|
||||
accesspoints: List[AccessPoint] = []
|
||||
for ap_object in (await inet.wireless.get_all_accesspoints())[0]:
|
||||
accesspoint = NetworkWirelessAP(ap_object)
|
||||
|
@ -17,6 +17,7 @@ from ..exceptions import (
|
||||
DBusInterfaceError,
|
||||
DBusNotConnectedError,
|
||||
DBusParseError,
|
||||
DBusProgramError,
|
||||
)
|
||||
|
||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||
@ -250,8 +251,8 @@ class DBus:
|
||||
raise exception()
|
||||
|
||||
# General
|
||||
_LOGGER.error("D-Bus return: %s", error.strip())
|
||||
raise DBusFatalError()
|
||||
_LOGGER.debug("D-Bus return: %s", error.strip())
|
||||
raise DBusProgramError(error.strip())
|
||||
|
||||
def attach_signals(self, filters=None):
|
||||
"""Generate a signals wrapper."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user