1
0
Fork 0
mirror of https://github.com/Luzifer/dns.git synced 2024-11-09 14:40:05 +00:00

Move healthcheck to python script

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-12-15 01:47:22 +01:00
parent c28c273d7a
commit 21ffa283ef
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 9 additions and 3 deletions

View file

@ -15,6 +15,7 @@ import consul
import dns.resolver
import dns.rdatatype
import jinja2
import requests
import yaml
DEFAULT_TTL = 3600
@ -131,6 +132,11 @@ def write_zone(zone, ttl, soa, nameserver, mailserver, entries):
os.unlink("zones/tmp.{}".format(zone))
def healthcheck():
if os.getenv('HC_PING') != '':
requests.get(os.getenv('HC_PING'))
def main():
zone_data = yaml.load(open("zones.yml"))
@ -155,6 +161,8 @@ def main():
write_zone(zone, ttl, zone_data['soa'],
zone_data['nameserver'], mailserver, entries)
healthcheck()
if __name__ == "__main__":
main()

View file

@ -2,6 +2,4 @@
set -euxo pipefail
cd /src
/usr/bin/python3 generateZonefiles.py
[ -n "${HC_PING}" ] && curl -sSfLo /dev/null "${HC_PING}"
exec /usr/bin/python3 generateZonefiles.py