Merge branch 'master' into ssm_docs

This commit is contained in:
Alex Bainbridge 2020-06-30 12:59:01 -04:00
commit ccaa33504a
5 changed files with 139 additions and 96 deletions

View file

@ -351,18 +351,21 @@ class CloudFormationResponse(BaseResponse):
return template.render(exports=exports, next_token=next_token)
def validate_template(self):
cfn_lint = self.cloudformation_backend.validate_template(
self._get_param("TemplateBody")
)
template_body = self._get_param("TemplateBody")
template_url = self._get_param("TemplateURL")
if template_url:
template_body = self._get_stack_from_s3_url(template_url)
cfn_lint = self.cloudformation_backend.validate_template(template_body)
if cfn_lint:
raise ValidationError(cfn_lint[0].message)
description = ""
try:
description = json.loads(self._get_param("TemplateBody"))["Description"]
description = json.loads(template_body)["Description"]
except (ValueError, KeyError):
pass
try:
description = yaml.load(self._get_param("TemplateBody"))["Description"]
description = yaml.load(template_body)["Description"]
except (yaml.ParserError, KeyError):
pass
template = self.response_template(VALIDATE_STACK_RESPONSE_TEMPLATE)

View file

@ -158,7 +158,7 @@ class ELBV2Response(BaseResponse):
condition = {}
condition["field"] = _condition["field"]
values = sorted(
[e for e in _condition.items() if e[0].startswith("values.member")],
[e for e in _condition.items() if "values.member" in e[0]],
key=lambda x: x[0],
)
condition["values"] = [e[1] for e in values]
@ -356,7 +356,7 @@ class ELBV2Response(BaseResponse):
condition = {}
condition["field"] = _condition["field"]
values = sorted(
[e for e in _condition.items() if e[0].startswith("values.member")],
[e for e in _condition.items() if "values.member" in e[0]],
key=lambda x: x[0],
)
condition["values"] = [e[1] for e in values]