Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
696bce30
authored
Aug 17, 2015
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: add --timeout switch for reload_firewall_command
parent
d5c57c8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
circle/firewall/management/commands/reload_firewall.py
+17
-1
circle/firewall/tasks/local_tasks.py
+1
-1
No files found.
circle/firewall/management/commands/reload_firewall.py
View file @
696bce30
...
@@ -21,6 +21,8 @@ from django.core.management.base import BaseCommand
...
@@ -21,6 +21,8 @@ from django.core.management.base import BaseCommand
from
firewall.tasks.local_tasks
import
reloadtask
from
firewall.tasks.local_tasks
import
reloadtask
from
argparse
import
ArgumentTypeError
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
...
@@ -33,6 +35,20 @@ class Command(BaseCommand):
...
@@ -33,6 +35,20 @@ class Command(BaseCommand):
default
=
False
,
default
=
False
,
help
=
'synchronous reload'
)
help
=
'synchronous reload'
)
parser
.
add_argument
(
'--timeout'
,
action
=
'store'
,
dest
=
'timeout'
,
default
=
15
,
type
=
self
.
positive_int
,
help
=
'timeout for synchronous reload'
)
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
reloadtask
(
'Vlan'
,
sync
=
options
[
"sync"
])
reloadtask
(
'Vlan'
,
sync
=
options
[
"sync"
],
timeout
=
options
[
"timeout"
])
def
positive_int
(
self
,
val
):
if
not
val
.
isdigit
():
raise
ArgumentTypeError
(
"'
%
s' is not a valid positive int"
%
val
)
return
int
(
val
)
circle/firewall/tasks/local_tasks.py
View file @
696bce30
...
@@ -109,4 +109,4 @@ def reloadtask(type='Host', timeout=15, sync=False):
...
@@ -109,4 +109,4 @@ def reloadtask(type='Host', timeout=15, sync=False):
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
]):
res
=
reloadtask_worker
.
apply_async
(
queue
=
'localhost.man'
,
countdown
=
5
)
res
=
reloadtask_worker
.
apply_async
(
queue
=
'localhost.man'
,
countdown
=
5
)
if
sync
:
if
sync
:
res
.
get
(
15
)
res
.
get
(
timeout
)
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