#!/usr/bin/python import itertools import json import string import sys import yaml from yamljsonlib import template_replace # Find all placeholders in the input and replace them with the values of # equivalently-named environment variables. def main(): with open(sys.argv[1]) as f: template = string.Template(f.read()) lava_template = template_replace(template) # FIXME: use ordered dictionaries - see http://pyyaml.org/ticket/29 config = json.dumps(yaml.safe_load(lava_template), indent=2, separators=(',', ': ')) print config if __name__ == '__main__': main()