Skip to content

Commit 24f6516

Browse files
committed
Ignore failure of ubus get_clients on startup
1 parent 686b09f commit 24f6516

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hapt/files/hapt.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,13 @@ def get_config(config, section):
7777
return next(iter(config['values'].values()))
7878

7979
def get_connected_clients(interface):
80-
response = ubus_call('hostapd.%s' % interface, 'get_clients')
81-
return response['clients'].keys()
80+
try:
81+
response = ubus_call('hostapd.%s' % interface, 'get_clients')
82+
return response['clients'].keys()
83+
except ValueError as e:
84+
# This can happen if the interface isn't fully up yet, it's fine to continue - we assume nothing is connected
85+
print("Failed to get connected clients: %s" % e)
86+
return []
8287

8388
def connect_hostapd_socket(interface):
8489
remote_address = '/var/run/hostapd/%s' % interface

0 commit comments

Comments
 (0)