Propagate global prometheus config to repo_config

This commit is contained in:
deajan 2024-05-07 23:01:20 +02:00
parent 85703d2073
commit 0f6436ea15

View file

@ -632,6 +632,29 @@ def get_repo_config(
except KeyError:
logger.error(f"No repo with name {repo_name} found in config")
return None, None
# Merge prometheus global settings with repo settings
prometheus_backup_job = None
try:
prometheus_backup_job = repo_config.g("prometheus.backup_job")
except KeyError:
logger.debug("No prometheus backup job found in repo config")
prometheus_group = None
try:
prometheus_group = repo_config.g("prometheus.group")
except KeyError:
logger.debug("No prometheus group found in repo config")
try:
repo_config.s("prometheus", deepcopy(full_config.g("global_prometheus")))
except KeyError:
logger.debug("No global prometheus settings found")
if prometheus_backup_job:
repo_config.s("prometheus.backup_job", prometheus_backup_job)
if prometheus_group:
repo_config.s("prometheus.group", prometheus_group)
try:
repo_group = full_config.g(f"repos.{repo_name}.repo_group")
group_config = full_config.g(f"groups.{repo_group}")