aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClint Byrum <clint@fewbar.com>2013-07-10 10:44:36 -0700
committerClint Byrum <clint@fewbar.com>2013-07-10 14:11:40 -0700
commitaebad8ce24f08042fa4814dd11761a9d15fae0a9 (patch)
tree5cb3e39db7e5b8550694a5821a6e1e334dbe1cdc
parent36b4e49819c0e7121a618f30f0cdec034ce9050e (diff)
Add FileInclude special type.
We need to be able to combine pieces without uploading bits to an accessible URL. Change-Id: If0cec8ce7c77fed786d54dd0af2eb7823c088920
-rw-r--r--merge.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/merge.py b/merge.py
index afb6b222..64cb00ab 100644
--- a/merge.py
+++ b/merge.py
@@ -87,6 +87,13 @@ for template_path in templates:
ikey = '%sImage' % (role)
end_template['Resources'][role]['Properties']['ImageId'] = {'Ref': ikey}
end_template['Parameters'][ikey] = {'Type': 'String'}
+ elif rbody['Type'] == 'FileInclude':
+ with open(rbody['Path']) as rfile:
+ include_content = yaml.safe_load(rfile.read())
+ subkeys = rbody.get('SubKey','').split('.')
+ while len(subkeys) and subkeys[0]:
+ include_content = include_content[subkeys.pop(0)]
+ end_template['Resources'][r] = include_content
else:
if r in end_template.get('Resources', {}):
if rbody != end_template['Resources'][r]: