Skip to content

Instantly share code, notes, and snippets.

@d0ugal
Created December 14, 2015 16:38
Show Gist options
  • Select an option

  • Save d0ugal/fa5a1302120a70762513 to your computer and use it in GitHub Desktop.

Select an option

Save d0ugal/fa5a1302120a70762513 to your computer and use it in GitHub Desktop.
# Call with: python mkplan.py tripleo-heat-templates > plan.json
import sys
import yaml
template_path = sys.argv[1]
import os
templates_dict = {}
for root, dirs, files in os.walk(template_path):
for f in files:
full_path = os.path.join(root, f)
with open(full_path) as ff:
if not full_path.endswith('.yaml'):
continue
full_path = full_path.replace("tripleo-heat-templates/", "")
templates_dict[full_path] = {'contents': ff.read().decode("latin1")}
#print repr(full_path)
import json
templates_dict['capabilities_map.yaml']['meta'] = {
'file-type': 'capabilities-map',
}
print json.dumps({"name": "overcloud", "files": templates_dict})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment