mirror of
https://github.com/netinvent/npbackup.git
synced 2025-10-24 04:16:30 +08:00
Propagate global prometheus config to repo_config
This commit is contained in:
parent
85703d2073
commit
0f6436ea15
1 changed files with 23 additions and 0 deletions
|
|
@ -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}")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue