From d273fa15f362c40d59463642bc044ccb18c0c2ec Mon Sep 17 00:00:00 2001 From: gilzellner Date: Mon, 14 Dec 2015 15:38:40 +0200 Subject: [PATCH] fix issue 488 --- moto/elb/exceptions.py | 8 ++++++++ moto/elb/models.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/moto/elb/exceptions.py b/moto/elb/exceptions.py index e2707b60a..33b3f20cc 100644 --- a/moto/elb/exceptions.py +++ b/moto/elb/exceptions.py @@ -27,3 +27,11 @@ class TooManyTagsError(ELBClientError): super(TooManyTagsError, self).__init__( "LoadBalancerNotFound", "The quota for the number of tags that can be assigned to a load balancer has been reached") + + +class BadHealthCheckDefinition(ELBClientError): + def __init__(self): + super(BadHealthCheckDefinition, self).__init__( + "ValidationError", + "HealthCheck Target must begin with one of HTTP, TCP, HTTPS, SSL") + diff --git a/moto/elb/models.py b/moto/elb/models.py index 2303e907c..8954f5e3c 100644 --- a/moto/elb/models.py +++ b/moto/elb/models.py @@ -10,7 +10,7 @@ from boto.ec2.elb.attributes import ( ) from boto.ec2.elb.policies import Policies from moto.core import BaseBackend -from .exceptions import LoadBalancerNotFoundError, TooManyTagsError +from .exceptions import LoadBalancerNotFoundError, TooManyTagsError, BadHealthCheckDefinition class FakeHealthCheck(object): @@ -21,6 +21,8 @@ class FakeHealthCheck(object): self.unhealthy_threshold = unhealthy_threshold self.interval = interval self.target = target + if not target.startswith(('HTTP', 'TCP', 'HTTPS', 'SSL')): + raise BadHealthCheckDefinition class FakeListener(object):