AWS: If we have no subnets, bail out early

We know the ELB call will fail, so we error out early rather than
hitting the API.  Preserves rate limit quota, and also allows us to give
a more self-evident message.

Fix #21993
pull/6/head
Justin Santa Barbara 2016-02-27 11:59:09 -05:00
parent 5cf837452b
commit 02e79b9e52
1 changed files with 5 additions and 0 deletions

View File

@ -2149,6 +2149,11 @@ func (s *AWSCloud) EnsureLoadBalancer(name, region string, publicIP net.IP, port
return nil, err
}
// Bail out early if there are no subnets
if len(subnetIDs) == 0 {
return nil, fmt.Errorf("could not find any suitable subnets for creating the ELB")
}
// Create a security group for the load balancer
var securityGroupID string
{