aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/generate_config.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/generate_config.py b/utils/generate_config.py
new file mode 100755
index 0000000..2a2f20d
--- /dev/null
+++ b/utils/generate_config.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+"""This module does blah blah."""
+import argparse
+import yaml
+from jinja2 import Environment, FileSystemLoader
+
+parser = argparse.ArgumentParser()
+parser.add_argument("--yaml", "-y", type=str, required=True)
+parser.add_argument("--jinja2", "-j", type=str, required=True)
+args = parser.parse_args()
+
+
+ENV = Environment(loader=FileSystemLoader('./'))
+
+with open(args.yaml) as _:
+ dict = yaml.safe_load(_)
+
+# Print dictionary generated from yaml (uncomment for debug)
+#print dict
+
+# Render template and print generated config to console
+template = ENV.get_template(args.jinja2)
+print template.render(config=dict)