Use the TemplateBody by default it exist

serverless cli use the PUT + TemplateBody + TemplateURL to upload cloudformation template

This fix try to get the TemplateBody from the request first, if not exist, fetch the one from s3 bucket
This commit is contained in:
Clive Li 2018-02-13 17:28:56 +11:00
parent 553d074241
commit 6e6ed28d79
2 changed files with 3 additions and 3 deletions

View File

@ -49,3 +49,4 @@ Moto is written by Steve Pulec with contributions from:
* [Michael van Tellingen](https://github.com/mvantellingen)
* [Jessie Nadler](https://github.com/nadlerjessie)
* [Alex Morken](https://github.com/alexmorken)
* [Clive Li](https://github.com/cliveli)

View File

@ -221,13 +221,12 @@ class CloudFormationResponse(BaseResponse):
stack_name = self._get_param('StackName')
role_arn = self._get_param('RoleARN')
template_url = self._get_param('TemplateURL')
stack_body = self._get_param('TemplateBody')
if self._get_param('UsePreviousTemplate') == "true":
stack_body = self.cloudformation_backend.get_stack(
stack_name).template
elif template_url:
elif not stack_body and template_url:
stack_body = self._get_stack_from_s3_url(template_url)
else:
stack_body = self._get_param('TemplateBody')
parameters = dict([
(parameter['parameter_key'], parameter['parameter_value'])