aboutsummaryrefslogtreecommitdiffstats
path: root/utils/generate_config.py
blob: 523a7a833274566640367790cbfd47c0e09798e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 conf to console
template = ENV.get_template(args.jinja2)
print template.render(conf=dict)