Mercurial > code > home > repos > victoriametrics
changeset 10:2023a6ce7bc0
some of the config-rebuild code
author | drewp@bigasterisk.com |
---|---|
date | Sun, 04 Dec 2022 02:09:40 -0800 |
parents | 17db5e8e7a2f |
children | 2eab3e6b89f2 |
files | tasks.py |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tasks.py Sun Dec 04 02:08:08 2022 -0800 +++ b/tasks.py Sun Dec 04 02:09:40 2022 -0800 @@ -1,4 +1,11 @@ +import json +import sys +import tempfile +import time import urllib.request +from pathlib import Path +from typing import Dict + from invoke import task @@ -11,6 +18,11 @@ path = {'victoriametrics': '/m', 'vmalert': '/vmalert'}[svc] print(' -> status', urllib.request.urlopen(f'http://{host}{path}/-/reload').status) +def hostsExpectedOnline(ctx): + return ctx.run( + 'cd /my/serv/lanscape; pdm run python hosts_expected_online.py').stdout + + @task @@ -24,3 +36,8 @@ ctx.run(updateConfigmapCmd("rules_k8s.yaml")) ctx.run(updateConfigmapCmd("rules_main.yaml")) reload(ctx, 'vmalert') + +@task +def build_config(ctx): + with open('rules/build/expected_hosts.yaml', 'w') as out: + out.write(hostsExpectedOnline(ctx))