Commit 95ef0c6d by Bach Dániel

firewall: fix imports

parent c4631b07
......@@ -12,6 +12,7 @@ import django.conf
from django.db.models.signals import post_save
import random
from firewall.tasks.local_tasks import reloadtask
settings = django.conf.settings.FIREWALL_SETTINGS
......@@ -782,8 +783,7 @@ class Blacklist(models.Model):
def send_task(sender, instance, created, **kwargs):
from firewall.tasks.local_tasks import reloadtask
reloadtask.apply_async(args=[sender.__name__], queue='localhost.firewall')
reloadtask.apply_async(args=[sender.__name__])
post_save.connect(send_task, sender=Host)
......
from manager.mancelery import celery
from django.core.cache import cache
from firewall.fw import Firewall, dhcp, dns, ipset
import django.conf
import remote_tasks
settings = django.conf.settings.FIREWALL_SETTINGS
@celery.task
def periodic_task():
from firewall.fw import Firewall, dhcp, dns, ipset, vlan
import remote_tasks
if cache.get('dns_lock'):
cache.delete("dns_lock")
remote_tasks.reload_dns_task.apply_async(args=[dns()],
queue='firewall')
remote_tasks.reload_dns.apply_async(args=[dns()],
queue='dns')
print "dns ujratoltese kesz"
if cache.get('dhcp_lock'):
cache.delete("dhcp_lock")
remote_tasks.reload_dhcp_task.delay(dhcp())
remote_tasks.reload_dhcp.apply_async(args=[dhcp()],
queue='firewall')
print "dhcp ujratoltese kesz"
if cache.get('firewall_lock'):
cache.delete("firewall_lock")
ipv4 = Firewall(proto=4).get()
ipv6 = Firewall(proto=6).get()
remote_tasks.reload_firewall_task.delay(ipv4, ipv6)
remote_tasks.reload_firewall.apply_async(args=[ipv4, ipv6],
queue='firewall')
print "firewall ujratoltese kesz"
if cache.get('blacklist_lock'):
cache.delete("blacklist_lock")
remote_tasks.reload_blacklist_task.delay(list(ipset()))
remote_tasks.reload_blacklist.apply_async(args=[list(ipset())],
queue='firewall')
print "blacklist ujratoltese kesz"
......
......@@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from .tasks import reloadtask
from .tasks.local_tasks import reloadtask
from .models import Blacklist, Host
......@@ -20,6 +20,7 @@ def reload_firewall(request):
html = (_("Dear %s, you've signed in as administrator!<br />"
"Reloading in 10 seconds...") % request.user.username)
reloadtask.delay()
reloadtask.delay('Vlan')
else:
html = (_("Dear %s, you've signed in!") % request.user.username)
else:
......
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