Skip to content

Commit

Permalink
Merge pull request #2053 from dsterne/master
Browse files Browse the repository at this point in the history
Wait for the Load Balancer to become active before proceeding
  • Loading branch information
jneves committed Mar 8, 2020
2 parents c399278 + 66c43d2 commit 716c2f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,19 @@ def test_zappa_core_deploy_lambda_alb(self):
}]
},
)
elbv2_stubber.add_response("describe_load_balancers",
expected_params={
"LoadBalancerArns": [loadbalancer_arn],
},
service_response={
"LoadBalancers": [{
"LoadBalancerArn": loadbalancer_arn,
"State": {
"Code": "active"
}
}]
},
)
elbv2_stubber.add_response("modify_load_balancer_attributes",
expected_params={
"LoadBalancerArn": loadbalancer_arn,
Expand Down
2 changes: 2 additions & 0 deletions zappa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,8 @@ def deploy_lambda_alb( self,
load_balancer_dns = response["LoadBalancers"][0]["DNSName"]
load_balancer_vpc = response["LoadBalancers"][0]["VpcId"]
waiter = self.elbv2_client.get_waiter('load_balancer_available')
print('Waiting for load balancer [{}] to become active..'.format(load_balancer_arn))
waiter.wait(LoadBalancerArns=[load_balancer_arn], WaiterConfig={"Delay": 3})

# Match the lambda timeout on the load balancer.
self.elbv2_client.modify_load_balancer_attributes(
Expand Down

0 comments on commit 716c2f2

Please sign in to comment.