Cloudformation: Fix - validate template yml fixes

This change fixes:
* Replace call to non-existent exception yaml.ParserError
* Catches yaml scanner error for valid json with tabs
* Supply yaml loader to ensure yaml loading throws exception validly for json with tabs and doesn't try to load the json incorrectly
This commit is contained in:
Shane 2020-06-30 22:35:47 +01:00
commit 0f062f68ff
No known key found for this signature in database
GPG key ID: 439BE3F7ABFB2A56
2 changed files with 21 additions and 2 deletions

View file

@ -365,8 +365,8 @@ class CloudFormationResponse(BaseResponse):
except (ValueError, KeyError):
pass
try:
description = yaml.load(template_body)["Description"]
except (yaml.ParserError, KeyError):
description = yaml.load(template_body, Loader=yaml.Loader)["Description"]
except (yaml.parser.ParserError, yaml.scanner.ScannerError, KeyError):
pass
template = self.response_template(VALIDATE_STACK_RESPONSE_TEMPLATE)
return template.render(description=description)