From e30e934272f16e3fa60454c37692034064a33a5c Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Tue, 1 Oct 2024 10:14:48 +0200 Subject: src: replace DEVICE env variable with get_ethernet_interface() Use a python function to obtain the main net interface. Detect the first ethernet inferface in use. Stop using the DEVICE environment variable. --- src/log.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/log.py') diff --git a/src/log.py b/src/log.py index 9478bb7..13c625a 100644 --- a/src/log.py +++ b/src/log.py @@ -9,6 +9,7 @@ import logging import logging.config import os +from src.utils.net import get_ethernet_interface class OgError(Exception): @@ -67,7 +68,7 @@ def _default_logging_live(): 'samba': { 'class': 'logging.FileHandler', 'formatter': 'formatter.syslogtime', - 'filename': f'/opt/opengnsys/log/{getifaddr(os.getenv("DEVICE"))}.log', + 'filename': f'/opt/opengnsys/log/{getifaddr(get_ethernet_interface())}.log', } } rtlog = { -- cgit v1.2.3-18-g5258