"active"
))
- logger.info("USERS DB: Admin user: %s with password %s - %s" ,
- settings.ADMIN_USER, settings.ADMIN_PASSWORD, settings.ADMIN_PASSWORD_HASH)
-
# -----------------------------
# Create User
# -----------------------------
# Welcome log
# ------------------------------------------------------------------------------
def print_welcome():
- safe_secret = "****" if settings.SECRET_KEY else "undefined"
- safe_admin_pwd = "****" if settings.ADMIN_PASSWORD else "undefined"
- safe_admin_hash = "****" if settings.ADMIN_PASSWORD_HASH else "undefined"
+ masked_secret = "****" if settings.SECRET_KEY else "undefined"
+ masked_admin_pwd = "****" if settings.ADMIN_PASSWORD else "undefined"
+ masked_admin_hash = "****" if settings.ADMIN_PASSWORD_HASH else "undefined"
logger.info(
"%s starting | app_version=%s | baseimg_version=%s",
)
logger.info(
"App settings: frontend=%s | port=%d | secret=%s",
- settings.FRONTEND_DIR, settings.HTTP_PORT, safe_secret
+ settings.FRONTEND_DIR, settings.HTTP_PORT, masked_secret
)
logger.info(
"Database: file=%s | reset=%s",
)
logger.info(
"Users: admin=%s | password=%s | hash=%s | hash_file=%s",
- settings.ADMIN_USER, safe_admin_pwd, safe_admin_hash, settings.ADMIN_PASSWORD_HASH_FILE
+ settings.ADMIN_USER, masked_admin_pwd, masked_admin_hash, settings.ADMIN_PASSWORD_HASH_FILE
)
logger.info(
"DNS: path=%s | host file=%s | alias file=%s | reverse file=%s",
from backend.db.hosts import get_hosts
# Import Settings
from settings.settings import settings
+# Import Logging
+from log.log import setup_logging, get_logger
# Create Router
router = APIRouter()
for h in hosts:
if h.get("ipv4") and h.get("mac"):
kea4_hosts.append({
- "hostname": h.get("name"),
"hw-address": h.get("mac"),
"ip-address": h.get("ipv4"),
+ "hostname": h.get("name"),
})
if h.get("ipv6") and h.get("mac"):
kea6_hosts.append({
- "hostname": h.get("name"),
- "hw-address": h.get("mac"),
- "ip-address": h.get("ipv6"),
+ "duid": h.get("mac"),
+ "ip-addresses": h.get("ipv6"),
+ "hostname": h.get("name"),
})
# Save DHCP4 Configuration
path = settings.DHCP4_HOST_FILE
+ data = {"hosts": kea4_hosts}
with open(path, "w", encoding="utf-8") as f:
- json.dump(kea4_hosts, f, indent=4, ensure_ascii=False)
+ json.dump(data, f, indent=4, ensure_ascii=False)
# Save DHCP6 Configuration
path = settings.DHCP6_HOST_FILE
+ data = {"hosts": kea6_hosts}
with open(path, "w", encoding="utf-8") as f:
- json.dump(kea6_hosts, f, indent=4, ensure_ascii=False)
+ json.dump(data, f, indent=4, ensure_ascii=False)
except Exception as err:
+ get_logger("dhcp").exception("Error reloading DHCP: " + str(err).strip())
error = True
- message = str(err).strip()
+ #message = str(err).strip()
if error:
code = "DHCP_RELOAD_ERROR"
from backend.db.hosts import get_hosts
# Import Settings
from settings.settings import settings
+# Import Logging
+from log.log import setup_logging, get_logger
# Create Router
router = APIRouter()
f.write(line)
except Exception as err:
+ get_logger("dns").exception("Error reloading DNS: " + str(err).strip())
error = True
- message = str(err).strip()
+ #message = str(err).strip()
if error:
code = "DNS_RELOAD_ERROR"
import os
# Import Settings
from settings.settings import settings
+# Import Logging
+from log.log import setup_logging, get_logger
# Create Router
router = APIRouter()
db_size = round(os.path.getsize(settings.DB_FILE) / (1024 * 1024), 2)
- except Exception as e:
+ except Exception as err:
+ get_logger("health").exception("Database health check failed: " + str(err).strip())
db_status = "error"
- db_version = str(e)
+ db_version = None
latency = round((time.time() - start) * 1000, 2)