Commit 61eae89b by Kálmán Viktor

Merge branch 'reload_firewall_timeout' into 'master'

Add --timeout switch for reload_firewall_command

See merge request !348
parents d5c57c8f 696bce30
......@@ -21,6 +21,8 @@ from django.core.management.base import BaseCommand
from firewall.tasks.local_tasks import reloadtask
from argparse import ArgumentTypeError
class Command(BaseCommand):
......@@ -33,6 +35,20 @@ class Command(BaseCommand):
default=False,
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):
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)
......@@ -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]):
res = reloadtask_worker.apply_async(queue='localhost.man', countdown=5)
if sync:
res.get(15)
res.get(timeout)
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