fixing use_sudo argument

This commit is contained in:
Stefan Midjich 2017-11-19 00:45:24 +01:00
parent c56ecc0d01
commit e6ad0f676f
2 changed files with 8 additions and 7 deletions

View file

@ -3,7 +3,7 @@ import subprocess
import shlex
def run_ipset(command, *args, **kw):
use_sudo = kw.get('use_sudo', True)
use_sudo = kw.get('use_sudo', False)
timeout = kw.get('timeout', 2)
if use_sudo:

View file

@ -97,12 +97,12 @@ config.readfp(args.config)
sr = StoragePostgres(config=config)
if args.refresh:
if getuid() == 0:
use_sudo = False
else:
use_sudo = True
if getuid() == 0:
use_sudo = False
else:
use_sudo = True
if args.refresh:
# Sync clients and packet counters from ipset into storage.
proc = run_ipset(
'list',
@ -201,7 +201,8 @@ for src_ip in args.src_ip:
client = Client(
storage=sr,
ip_address=src_ip,
ipset_name=config.get('ipset', 'ipset_name')
ipset_name=config.get('ipset', 'ipset_name'),
use_sudo=use_sudo
)
if args.delete: