File tree Expand file tree Collapse file tree 3 files changed +4
-12
lines changed Expand file tree Collapse file tree 3 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ services:
28
28
context : .
29
29
dockerfile : Dockerfile
30
30
network_mode : " host"
31
- restart : always
31
+ restart : on-failure
32
32
volumes :
33
33
- " py_wifi_connect_db:/app/db" # Optional if not setting the hotspot ssid and password via the API
34
34
labels :
Original file line number Diff line number Diff line change @@ -46,10 +46,6 @@ class WifiNetworkManagerError(Exception):
46
46
pass
47
47
48
48
49
- class WifiNoSuitableDevice (Exception ):
50
- pass
51
-
52
-
53
49
# Custom error messages for Flask-RESTful to return
54
50
errors = {
55
51
"WifiConnectionFailed" : {
@@ -72,8 +68,4 @@ class WifiNoSuitableDevice(Exception):
72
68
"message" : "Failed communicating with Network Manager." ,
73
69
"status" : 500 ,
74
70
},
75
- "WifiNoSuitableDevice" : {
76
- "message" : "No suitable Wi-Fi device available." ,
77
- "status" : 404 ,
78
- },
79
71
}
Original file line number Diff line number Diff line change 3
3
import os
4
4
import socket
5
5
import subprocess
6
+ import sys
6
7
import time
7
8
from common .errors import logger
8
9
from common .errors import WifiConnectionFailed
9
10
from common .errors import WifiDeviceNotFound
10
11
from common .errors import WifiHotspotStartFailed
11
12
from common .errors import WifiNetworkManagerError
12
- from common .errors import WifiNoSuitableDevice
13
13
from common .nm_dicts import get_nm_dict
14
14
from common .system import led
15
15
from time import sleep
@@ -251,8 +251,8 @@ def get_device():
251
251
if Pnm .NM_DEVICE_TYPE_WIFI in devices :
252
252
return devices [Pnm .NM_DEVICE_TYPE_WIFI ]
253
253
else :
254
- logger .error ("No suitable or available device found." )
255
- raise WifiNoSuitableDevice
254
+ logger .error ("No suitable or available device found. Exiting. " )
255
+ sys . exit ( 0 )
256
256
257
257
258
258
def list_access_points ():
You can’t perform that action at this time.
0 commit comments