Commit fc695d86 by Bach Dániel

firewall: hotfix

parent 41361840
...@@ -402,6 +402,8 @@ def dns(): ...@@ -402,6 +402,8 @@ def dns():
DNS.append("@%(fqdn)s::%(mx)s:%(dist)s:%(ttl)s" % DNS.append("@%(fqdn)s::%(mx)s:%(dist)s:%(ttl)s" %
{'fqdn': d['name'], 'mx': mx[1], 'dist': mx[0], {'fqdn': d['name'], 'mx': mx[1], 'dist': mx[0],
'ttl': d['ttl']}) 'ttl': d['ttl']})
elif d['type'] == 'PTR':
DNS.append("^%s:%s:%s" % (d['name'], d['address'], d['ttl']))
return DNS return DNS
process = subprocess.Popen(['/usr/bin/ssh', 'tinydns@%s' % process = subprocess.Popen(['/usr/bin/ssh', 'tinydns@%s' %
......
...@@ -17,21 +17,32 @@ def reload_dhcp_task(data): ...@@ -17,21 +17,32 @@ def reload_dhcp_task(data):
pass pass
class ReloadTask(Task): class ReloadTask(Task):
def run(self, type): def run(self, type='Host'):
sleep=False
if type in ["Host", "Records", "Domain", "Vlan"]: if type in ["Host", "Records", "Domain", "Vlan"]:
lock = lambda: cache.add("dns_lock", "true", 9) lock = lambda: cache.add("dns_lock", "true", 9)
if lock(): if lock():
if not sleep:
sleep = True
time.sleep(10)
reload_dns_task.delay(dns()) reload_dns_task.delay(dns())
if type == "Host": if type == "Host":
lock = lambda: cache.add("dhcp_lock", "true", 9) lock = lambda: cache.add("dhcp_lock", "true", 9)
if lock(): if lock():
if not sleep:
sleep = True
time.sleep(10)
reload_dhcp_task.delay(dhcp()) reload_dhcp_task.delay(dhcp())
if type in ["Host", "Rule", "Firewall"]: if type in ["Host", "Rule", "Firewall"]:
lock = lambda: cache.add("firewall_lock", "true", 9) lock = lambda: cache.add("firewall_lock", "true", 9)
if lock(): if lock():
if not sleep:
sleep = True
time.sleep(10)
ipv4 = firewall().get() ipv4 = firewall().get()
ipv6 = firewall(True).get() ipv6 = firewall(True).get()
reload_firewall_task.delay(ipv4, ipv6) reload_firewall_task.delay(ipv4, ipv6)
......
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