Commit db009ffc by Czémán Arnold

Merge branch 'rework' into 'master'

Rework

See merge request !2
parents 67944074 8384d8ed
from os import getenv
from os import getenv, path
import subprocess
from kombu import Queue, Exchange
......@@ -8,6 +8,7 @@ from celery import Celery
HOSTNAME = gethostname()
AMQP_URI = getenv('AMQP_URI')
DNS_DB_DIR = getenv('DNS_DB_DIR', '/var/lib/circle/dnsdriver')
celery = Celery('dnsdriver', broker=AMQP_URI)
celery.conf.update(
......@@ -21,9 +22,9 @@ celery.conf.update(
@celery.task(name='firewall.reload_dns')
def t(data):
with open('/etc/sv/tinydns/root/data', 'w') as f:
def reload_dns(data):
with open(path.join(DNS_DB_DIR, 'data'), 'w') as f:
f.write('\n'.join(data))
process = subprocess.Popen(['make', '-C', '/etc/sv/tinydns/root'],
process = subprocess.Popen(['make', '-C', DNS_DB_DIR],
shell=False, stdin=subprocess.PIPE)
process.communicate('\n'.join(data) + '\n')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment