mirror of
https://github.com/Luzifer/dns.git
synced 2024-12-22 10:51:20 +00:00
Move healthcheck to python script
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
c28c273d7a
commit
21ffa283ef
2 changed files with 9 additions and 3 deletions
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue