update picked data strucures
This commit is contained in:
+5
-1
@@ -89,9 +89,13 @@ async def reload_configuration(config_obj, config_path, components):
|
|||||||
# Reload users
|
# Reload users
|
||||||
users_mod.load_users(new_config)
|
users_mod.load_users(new_config)
|
||||||
|
|
||||||
# Re-apply host access from updated config to all known hosts
|
# Re-apply host attributes from updated config to all known hosts
|
||||||
from . import config as config_mod
|
from . import config as config_mod
|
||||||
|
dyndnshosts = config_mod.get_dyndnshosts(new_config)
|
||||||
|
watchhosts = config_mod.get_watchhosts(new_config)
|
||||||
for hostname, host in hbdclass.Host.hosts.items():
|
for hostname, host in hbdclass.Host.hosts.items():
|
||||||
|
host.dyn = hostname in dyndnshosts
|
||||||
|
host.watched = hostname in watchhosts
|
||||||
access = config_mod.get_host_access(new_config, hostname)
|
access = config_mod.get_host_access(new_config, hostname)
|
||||||
host.apply_access(access["owner"], access["managers"], access["monitors"])
|
host.apply_access(access["owner"], access["managers"], access["monitors"])
|
||||||
|
|
||||||
|
|||||||
+11
-2
@@ -120,8 +120,11 @@ class AlertState:
|
|||||||
|
|
||||||
# Helper to sanitize numeric values for JSON (handle inf/nan)
|
# Helper to sanitize numeric values for JSON (handle inf/nan)
|
||||||
def sanitize_value(val):
|
def sanitize_value(val):
|
||||||
if isinstance(val, float) and (math.isinf(val) or math.isnan(val)):
|
if isinstance(val, float):
|
||||||
return None
|
if math.isinf(val):
|
||||||
|
return "overdue"
|
||||||
|
if math.isnan(val):
|
||||||
|
return None
|
||||||
return val
|
return val
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
@@ -148,6 +151,12 @@ class AlertState:
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def __setstate__(self, state):
|
||||||
|
"""Restore from pickle, backfilling fields added after the pickle was written."""
|
||||||
|
self.__dict__.update(state)
|
||||||
|
if not hasattr(self, 'consecutive_count'):
|
||||||
|
self.consecutive_count = 0
|
||||||
|
|
||||||
def acknowledge(self):
|
def acknowledge(self):
|
||||||
"""Acknowledge this alert to stop reminder notifications."""
|
"""Acknowledge this alert to stop reminder notifications."""
|
||||||
self.acknowledged = True
|
self.acknowledged = True
|
||||||
|
|||||||
Reference in New Issue
Block a user