Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8ddf8f87
authored
Aug 03, 2015
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'synchronous_reload' into 'master'
Synchronous firewall reload See merge request
!345
parents
acb2f78f
55a0a8e5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
circle/firewall/management/commands/reload_firewall.py
+12
-1
circle/firewall/tasks/local_tasks.py
+5
-3
requirements/base.txt
+1
-1
No files found.
circle/firewall/management/commands/reload_firewall.py
View file @
8ddf8f87
...
@@ -23,5 +23,16 @@ from firewall.tasks.local_tasks import reloadtask
...
@@ -23,5 +23,16 @@ from firewall.tasks.local_tasks import reloadtask
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
'--sync'
,
action
=
'store_const'
,
dest
=
'sync'
,
const
=
True
,
default
=
False
,
help
=
'synchronous reload'
)
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
reloadtask
(
'Vlan'
)
reloadtask
(
'Vlan'
,
sync
=
options
[
"sync"
])
circle/firewall/tasks/local_tasks.py
View file @
8ddf8f87
...
@@ -60,7 +60,7 @@ def get_firewall_queues():
...
@@ -60,7 +60,7 @@ def get_firewall_queues():
return
list
(
retval
)
return
list
(
retval
)
@celery.task
(
ignore_result
=
True
)
@celery.task
def
reloadtask_worker
():
def
reloadtask_worker
():
from
firewall.fw
import
BuildFirewall
,
dhcp
,
dns
,
ipset
,
vlan
from
firewall.fw
import
BuildFirewall
,
dhcp
,
dns
,
ipset
,
vlan
from
remote_tasks
import
(
reload_dns
,
reload_dhcp
,
reload_firewall
,
from
remote_tasks
import
(
reload_dns
,
reload_dhcp
,
reload_firewall
,
...
@@ -92,7 +92,7 @@ def reloadtask_worker():
...
@@ -92,7 +92,7 @@ def reloadtask_worker():
@celery.task
@celery.task
def
reloadtask
(
type
=
'Host'
,
timeout
=
15
):
def
reloadtask
(
type
=
'Host'
,
timeout
=
15
,
sync
=
False
):
reload
=
{
reload
=
{
'Host'
:
[
'dns'
,
'dhcp'
,
'firewall'
],
'Host'
:
[
'dns'
,
'dhcp'
,
'firewall'
],
'Record'
:
[
'dns'
],
'Record'
:
[
'dns'
],
...
@@ -107,4 +107,6 @@ def reloadtask(type='Host', timeout=15):
...
@@ -107,4 +107,6 @@ def reloadtask(type='Host', timeout=15):
logger
.
info
(
"Reload
%
s on next periodic iteration applying change to
%
s."
,
logger
.
info
(
"Reload
%
s on next periodic iteration applying change to
%
s."
,
", "
.
join
(
reload
),
type
)
", "
.
join
(
reload
),
type
)
if
all
([
cache
.
add
(
"
%
s_lock"
%
i
,
'true'
,
30
)
for
i
in
reload
]):
if
all
([
cache
.
add
(
"
%
s_lock"
%
i
,
'true'
,
30
)
for
i
in
reload
]):
reloadtask_worker
.
apply_async
(
queue
=
'localhost.man'
,
countdown
=
5
)
res
=
reloadtask_worker
.
apply_async
(
queue
=
'localhost.man'
,
countdown
=
5
)
if
sync
:
res
.
get
(
15
)
requirements/base.txt
View file @
8ddf8f87
...
@@ -31,7 +31,7 @@ python-dateutil==2.4.2
...
@@ -31,7 +31,7 @@ python-dateutil==2.4.2
pyinotify==0.9.5
pyinotify==0.9.5
pytz==2015.4
pytz==2015.4
requests==2.7.0
requests==2.7.0
salt==201
5.5
.1
salt==201
4.7
.1
shutilwhich==1.1.0
shutilwhich==1.1.0
simplejson==3.7.2
simplejson==3.7.2
six==1.9.0
six==1.9.0
...
...
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