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
dc2a3c46
authored
Jul 22, 2015
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cloud: firewall: make synchronous reload_firewall_sync command
parent
acb2f78f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
circle/firewall/management/commands/reload_firewall_sync.py
+27
-0
circle/firewall/tasks/local_tasks.py
+5
-3
No files found.
circle/firewall/management/commands/reload_firewall_sync.py
0 → 100644
View file @
dc2a3c46
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# CIRCLE is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
unicode_literals
,
absolute_import
from
django.core.management.base
import
BaseCommand
from
firewall.tasks.local_tasks
import
reloadtask
class
Command
(
BaseCommand
):
def
handle
(
self
,
*
args
,
**
options
):
reloadtask
(
'Vlan'
,
sync
=
True
)
circle/firewall/tasks/local_tasks.py
View file @
dc2a3c46
...
@@ -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
((
sync
,),
queue
=
'localhost.man'
,
countdown
=
5
)
if
sync
:
res
.
get
(
15
)
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