[FIX] hw_drivers: Do not send request if the IoT is in access point

If IoT Box is in access point mode and a server is configured
the box try to reach the server.
But in access point mode all requests are redirected to the box

So now before return True in function 'get_odoo_server_url'
we verify if the service 'hostapd' is inactive

closes odoo/odoo#46141

X-original-commit: 365f0e384630bad16e0872d2307702fca5a4e295
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
This commit is contained in:
lejeune quentin
2020-02-24 16:03:12 +00:00
parent 1744878573
commit fff277a4a7
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ class StatusController(http.Controller):
"""
server = helpers.get_odoo_server_url()
image = get_resource_path('hw_drivers', 'static/img', 'False.jpg')
if server == '':
if not server:
credential = b64decode(token).decode('utf-8').split('|')
url = credential[0]
token = credential[1]
+3
View File
@@ -134,6 +134,9 @@ def get_ssid():
return subprocess.check_output(['sed', 's/.*"\\(.*\\)"/\\1/'], stdin=process_grep.stdout).decode('utf-8').rstrip()
def get_odoo_server_url():
ap = subprocess.call(['systemctl', 'is-active', 'hostapd']) # if service is active return 0 else inactive
if not ap:
return False
return read_file_first_line('odoo-remote-server.conf')
def get_token():