mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 03:22:51 +01:00
auto-t: no hostapd instance graceful failure
If a test does not need any hostapd instances but still loads hostapd.py for some reason we want to gracefully throw an exception rather than fail in some other manor.
This commit is contained in:
parent
9c72d2f546
commit
ebd712af4e
@ -32,6 +32,10 @@ class HostapdCLI:
|
|||||||
def _init_hostapd(self, config=None):
|
def _init_hostapd(self, config=None):
|
||||||
global ctrl_count
|
global ctrl_count
|
||||||
interface = None
|
interface = None
|
||||||
|
self.ctrl_sock = None
|
||||||
|
|
||||||
|
if not ctx.hostapd:
|
||||||
|
raise Exception("No hostapd instances are configured")
|
||||||
|
|
||||||
if not config and len(ctx.hostapd.instances) > 1:
|
if not config and len(ctx.hostapd.instances) > 1:
|
||||||
raise Exception('config must be provided if more than one hostapd instance exists')
|
raise Exception('config must be provided if more than one hostapd instance exists')
|
||||||
@ -110,6 +114,9 @@ class HostapdCLI:
|
|||||||
raise Exception('timeout waiting for control response')
|
raise Exception('timeout waiting for control response')
|
||||||
|
|
||||||
def _del_hostapd(self, force=False):
|
def _del_hostapd(self, force=False):
|
||||||
|
if not self.ctrl_sock:
|
||||||
|
return
|
||||||
|
|
||||||
self.ctrl_sock.close()
|
self.ctrl_sock.close()
|
||||||
os.remove(self.local_ctrl)
|
os.remove(self.local_ctrl)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user