Fix so-yaml get to print scalar values without YAML document end marker

This commit is contained in:
Mike Reeves
2026-03-13 15:34:04 -04:00
parent e2483e4be0
commit 7f4adb70bd
2 changed files with 5 additions and 2 deletions

View File

@@ -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

View File

@@ -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