fix: run full reload after HTTP config publish, not just config.reload()

HTTP config-mutating endpoints (publish, rollback, channel CRUD, user
self-update) were calling config.reload() directly, which only refreshed
the in-memory config dict. This skipped re-applying host.dyn/host.watched
flags to live Host objects, so enabling dyndns via the UI had no effect
until a SIGHUP was sent.

Wire a reload_callback through http.start() that calls the same
reload_configuration() function used by the SIGHUP handler, ensuring
host attributes, notify module, users, and threshold checker are all
updated on every config publish.

Also fix unmatched quote in udp.py f-string log message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Andreas Wrede
2026-05-12 15:05:52 -04:00
parent a00282913b
commit 817ae064af
3 changed files with 27 additions and 10 deletions
+22 -9
View File
@@ -264,6 +264,7 @@ async def start(
get_now=None,
VER="",
threshold_checker=None,
reload_callback=None,
):
"""Start an aiohttp web server and block until cancelled.
@@ -1319,9 +1320,11 @@ async def start(
logger.error("Config write failed: %s", exc)
return web.json_response({"error": str(exc)}, status=500)
if hasattr(config, "reload"):
if reload_callback:
await reload_callback()
elif hasattr(config, "reload"):
await config.reload()
users_mod.load_users(config)
users_mod.load_users(config)
return web.json_response({"ok": True})
@@ -1350,9 +1353,11 @@ async def start(
logger.error("Rollback failed: %s", exc)
return web.json_response({"error": str(exc)}, status=500)
if hasattr(config, "reload"):
if reload_callback:
await reload_callback()
elif hasattr(config, "reload"):
await config.reload()
users_mod.load_users(config)
users_mod.load_users(config)
return web.json_response({"ok": True})
@@ -1474,7 +1479,9 @@ async def start(
logger.error("Channel create failed: %s", exc)
return web.json_response({"error": str(exc)}, status=500)
if hasattr(config, "reload"):
if reload_callback:
await reload_callback()
elif hasattr(config, "reload"):
await config.reload()
return web.json_response({"ok": True, "name": name})
@@ -1540,7 +1547,9 @@ async def start(
logger.error("Channel update failed: %s", exc)
return web.json_response({"error": str(exc)}, status=500)
if hasattr(config, "reload"):
if reload_callback:
await reload_callback()
elif hasattr(config, "reload"):
await config.reload()
return web.json_response({"ok": True})
@@ -1572,7 +1581,9 @@ async def start(
logger.error("Channel delete failed: %s", exc)
return web.json_response({"error": str(exc)}, status=500)
if hasattr(config, "reload"):
if reload_callback:
await reload_callback()
elif hasattr(config, "reload"):
await config.reload()
return web.json_response({"ok": True})
@@ -1631,9 +1642,11 @@ async def start(
logger.error("User self-update failed: %s", exc)
return web.json_response({"error": str(exc)}, status=500)
if hasattr(config, "reload"):
if reload_callback:
await reload_callback()
elif hasattr(config, "reload"):
await config.reload()
users_mod.load_users(config)
users_mod.load_users(config)
return web.json_response({"ok": True})