mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
Remove Jinja from yaml files before parsing
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@@ -71,7 +72,14 @@ def checkApplyOption(options):
|
|||||||
|
|
||||||
def loadYaml(filename):
|
def loadYaml(filename):
|
||||||
file = open(filename, "r")
|
file = open(filename, "r")
|
||||||
return yaml.safe_load(file.read())
|
content = file.read()
|
||||||
|
|
||||||
|
# Remove Jinja templating
|
||||||
|
content = content.replace("{{ ssh_port }}", "22")
|
||||||
|
pattern = r'.*({%|{{|}}|%}).*'
|
||||||
|
content = re.sub(pattern, "", content)
|
||||||
|
|
||||||
|
return yaml.safe_load(content)
|
||||||
|
|
||||||
def writeYaml(filename, content):
|
def writeYaml(filename, content):
|
||||||
file = open(filename, "w")
|
file = open(filename, "w")
|
||||||
|
|||||||
Reference in New Issue
Block a user