mirror of
https://codeberg.org/prof_x_pvt_ltd/captive.whump.shanti-portal
synced 2024-08-14 22:46:42 +00:00
fixing use_sudo argument
This commit is contained in:
parent
c56ecc0d01
commit
e6ad0f676f
2 changed files with 8 additions and 7 deletions
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue