]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat api : allow validation of YAML templates via cfn api
authorSteven Hardy <shardy@redhat.com>
Thu, 21 Feb 2013 17:29:21 +0000 (17:29 +0000)
committerSteven Hardy <shardy@redhat.com>
Thu, 21 Feb 2013 17:30:33 +0000 (17:30 +0000)
Currently validation only works if the template is json

fixes bug 1131290

Change-Id: Ia08ba7cc18908697b5fdfc1eb711d84d7b39c7cb

heat/api/cfn/v1/stacks.py

index 2be5c5eecfc98adde70a3aaf4601060b439697ee..413e32394ae42cbce8d0ba1bc6b7f8a07e893bf1 100644 (file)
@@ -319,7 +319,7 @@ class StackController(object):
         try:
             stack = template_format.parse(templ)
         except ValueError:
-            msg = _("The Template must be a JSON document.")
+            msg = _("The Template must be a JSON or YAML document.")
             return exception.HeatInvalidParameterValueError(detail=msg)
 
         args = {'template': stack,
@@ -397,9 +397,9 @@ class StackController(object):
             return exception.HeatMissingParameterError(detail=msg)
 
         try:
-            template = json.loads(templ)
+            template = template_format.parse(templ)
         except ValueError:
-            msg = _("The Template must be a JSON document.")
+            msg = _("The Template must be a JSON or YAML document.")
             return exception.HeatInvalidParameterValueError(detail=msg)
 
         logger.info('validate_template')