increase ipset command timeout for cli tool

This commit is contained in:
Stefan Midjich 2017-11-16 13:49:50 +01:00
parent eddb4c0ced
commit 70c0c3049a
2 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import shlex
def run_ipset(command, *args, **kw): def run_ipset(command, *args, **kw):
use_sudo = kw.get('use_sudo', True) use_sudo = kw.get('use_sudo', True)
timeout = kw.get('timeout', 2)
if use_sudo: if use_sudo:
ipset_cmd = 'sudo ipset' ipset_cmd = 'sudo ipset'
@ -19,7 +20,7 @@ def run_ipset(command, *args, **kw):
proc = subprocess.call( proc = subprocess.call(
shlex.split(full_command), shlex.split(full_command),
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
timeout=2 timeout=timeout
) )
return proc return proc

View File

@ -103,7 +103,8 @@ if args.refresh:
config.get('ipset', 'set_name'), config.get('ipset', 'set_name'),
'-output', '-output',
'save', 'save',
use_sudo=False use_sudo=False,
timeout=30
) )
for _line in proc.stdout.splitlines(): for _line in proc.stdout.splitlines():