Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
95ef0c6d
authored
Oct 02, 2013
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: fix imports
parent
c4631b07
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
10 deletions
+15
-10
circle/firewall/models.py
+2
-2
circle/firewall/tasks/local_tasks.py
+11
-7
circle/firewall/views.py
+2
-1
No files found.
circle/firewall/models.py
View file @
95ef0c6d
...
...
@@ -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
)
...
...
circle/firewall/tasks/local_tasks.py
View file @
95ef0c6d
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"
...
...
circle/firewall/views.py
View file @
95ef0c6d
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment