mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-03-25 05:52:41 +01:00
Fix so-yaml get to print scalar values without YAML document end marker
This commit is contained in:
@@ -346,7 +346,10 @@ def get(args):
|
||||
print(f"Key '{key}' not found by so-yaml.py", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
print(yaml.safe_dump(output))
|
||||
if isinstance(output, (dict, list)):
|
||||
print(yaml.safe_dump(output).strip())
|
||||
else:
|
||||
print(output)
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ migrate_pcap_to_suricata() {
|
||||
|
||||
for pillar_file in "$PCAPFILE" "$MINIONDIR"/*.sls; do
|
||||
[[ -f "$pillar_file" ]] || continue
|
||||
pcap_enabled=$(so-yaml.py get "$pillar_file" pcap.enabled 2>/dev/null | head -1) || continue
|
||||
pcap_enabled=$(so-yaml.py get "$pillar_file" pcap.enabled 2>/dev/null) || continue
|
||||
so-yaml.py add "$pillar_file" suricata.pcap.enabled "$pcap_enabled"
|
||||
so-yaml.py remove "$pillar_file" pcap
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user