summaryrefslogtreecommitdiff
path: root/heatclient/common/template_format.py
diff options
context:
space:
mode:
authorhuangtianhua <huangtianhua@huawei.com>2014-01-29 16:03:46 +0800
committerhuangtianhua <huangtianhua@huawei.com>2014-02-25 18:16:34 +0800
commitc49fd710e45ca3fb1640c80dead2ad3450e1cf96 (patch)
tree62beaf2595c340fc0d39a77b7147a84f4f421ae6 /heatclient/common/template_format.py
parent55ad4b715439c672c2392a0a9106e9941e08ad9f (diff)
downloadpython-heatclient-c49fd710e45ca3fb1640c80dead2ad3450e1cf96.tar.gz
"version" section should be required in template
Adding the version checking to keep place with heat. Change-Id: Ib2f0b55c3c9e8b0a8f26e972b37a979d8d703f7c Closes-Bug: #1273980
Diffstat (limited to 'heatclient/common/template_format.py')
-rw-r--r--heatclient/common/template_format.py23
1 files changed, 5 insertions, 18 deletions
diff --git a/heatclient/common/template_format.py b/heatclient/common/template_format.py
index 0a7432f..2600449 100644
--- a/heatclient/common/template_format.py
+++ b/heatclient/common/template_format.py
@@ -59,22 +59,9 @@ def parse(tmpl_str):
else:
if tpl is None:
tpl = {}
- if u'heat_template_version' not in tpl:
- default_for_missing(tpl, u'HeatTemplateFormatVersion',
- HEAT_VERSIONS)
+ # Looking for supported version keys in the loaded template
+ if not ('HeatTemplateFormatVersion' in tpl
+ or 'heat_template_version' in tpl
+ or 'AWSTemplateFormatVersion' in tpl):
+ raise ValueError("Template format version not found.")
return tpl
-
-
-def default_for_missing(tpl, version_param, versions):
- '''Checks a parsed template for missing version and sections.
-
- This is currently only applied to YAML templates.
- '''
- # if version is missing, implicitly use the lastest one
- if version_param not in tpl:
- tpl[version_param] = versions[-1]
-
- # create empty placeholders for any of the main dict sections
- for param in (u'Parameters', u'Mappings', u'Resources', u'Outputs'):
- if param not in tpl:
- tpl[param] = {}