From: Steven Hardy Date: Thu, 21 Feb 2013 17:29:21 +0000 (+0000) Subject: heat api : allow validation of YAML templates via cfn api X-Git-Tag: 2014.1~869^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a2911cebd6e9c66a64ad95c4b7351a5f5002d640;p=openstack-build%2Fheat-build.git heat api : allow validation of YAML templates via cfn api Currently validation only works if the template is json fixes bug 1131290 Change-Id: Ia08ba7cc18908697b5fdfc1eb711d84d7b39c7cb --- diff --git a/heat/api/cfn/v1/stacks.py b/heat/api/cfn/v1/stacks.py index 2be5c5ee..413e3239 100644 --- a/heat/api/cfn/v1/stacks.py +++ b/heat/api/cfn/v1/stacks.py @@ -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')