mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 09:42:46 +01:00
Correct mod_so_status to only act on single string
This commit is contained in:
@@ -100,18 +100,18 @@ def write_pillar(pillar: str, content: dict):
|
|||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
|
|
||||||
def mod_so_status(action: str, items: List):
|
def mod_so_status(action: str, item: str):
|
||||||
with open(so_status_conf, 'a+') as conf:
|
with open(so_status_conf, 'a+') as conf:
|
||||||
conf.seek(0)
|
conf.seek(0)
|
||||||
containers = conf.readlines()
|
containers = conf.readlines()
|
||||||
|
|
||||||
for item in items:
|
if f'so-{item}\n' in containers:
|
||||||
if f'so-{item}\n' in containers:
|
if action == 'remove': containers.remove(f'so-{item}\n')
|
||||||
if action == 'remove': containers.remove(f'so-{item}\n')
|
if action == 'add': pass
|
||||||
if action == 'add': pass
|
else:
|
||||||
else:
|
if action == 'remove': pass
|
||||||
if action == 'remove': pass
|
if action == 'add': containers.append(f'so-{item}\n')
|
||||||
if action == 'add': containers.append(f'so-{item}\n')
|
|
||||||
|
|
||||||
[containers.remove(c_name) for c_name in containers if c_name == '\n'] # remove extra newlines
|
[containers.remove(c_name) for c_name in containers if c_name == '\n'] # remove extra newlines
|
||||||
|
|
||||||
@@ -193,12 +193,10 @@ def enable_disable_modules(args, enable: bool):
|
|||||||
|
|
||||||
def enable_modules(args):
|
def enable_modules(args):
|
||||||
enable_disable_modules(args, enable=True)
|
enable_disable_modules(args, enable=True)
|
||||||
mod_so_status('add', args.modules)
|
|
||||||
|
|
||||||
|
|
||||||
def disable_modules(args):
|
def disable_modules(args):
|
||||||
enable_disable_modules(args, enable=False)
|
enable_disable_modules(args, enable=False)
|
||||||
mod_so_status('remove', args.modules)
|
|
||||||
|
|
||||||
|
|
||||||
def list_modules(*_):
|
def list_modules(*_):
|
||||||
|
|||||||
Reference in New Issue
Block a user