From b4920bfe554685eede5e646365f022b75652ab99 Mon Sep 17 00:00:00 2001 From: lejeune quentin Date: Wed, 9 Jun 2021 13:44:38 +0000 Subject: [PATCH] [FIX] hw_drivers: Hide hostapd status in IoT We call the status of the hostapd in each request of 'get_odoo_server_url()' and 'get_ssid()' And this call display in the log the status '0' or 'inactive' in the log With this commit we hide this useless information closes odoo/odoo#72133 X-original-commit: e5e9f9f91cf9bf35f1e0b307008840a0de134e2f Signed-off-by: Quentin Lejeune (qle) --- addons/hw_drivers/tools/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hw_drivers/tools/helpers.py b/addons/hw_drivers/tools/helpers.py index b50a5a30ef9f4..3254e179e3839 100644 --- a/addons/hw_drivers/tools/helpers.py +++ b/addons/hw_drivers/tools/helpers.py @@ -146,7 +146,7 @@ def get_mac_address(): return netifaces.ifaddresses('wlan0')[netifaces.AF_LINK][0]['addr'] def get_ssid(): - ap = subprocess.call(['systemctl', 'is-active', 'hostapd']) # if service is active return 0 else inactive + ap = subprocess.call(['systemctl', 'is-active', '--quiet', 'hostapd']) # if service is active return 0 else inactive if not ap: return subprocess.check_output(['grep', '-oP', '(?<=ssid=).*', '/etc/hostapd/hostapd.conf']).decode('utf-8').rstrip() process_iwconfig = subprocess.Popen(['iwconfig'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) @@ -154,7 +154,7 @@ 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 + ap = subprocess.call(['systemctl', 'is-active', '--quiet', 'hostapd']) # if service is active return 0 else inactive if not ap: return False return read_file_first_line('odoo-remote-server.conf')