resources: aws: ec2: Retry on exceeded wait attempts error

The waiters now return the AwsErr error "ResourceNotReady: exceeded wait
attempts" when the instance state does not converge after 40 retries.
During longpollWatch() we need to detect this error and continue to
the top of the loop so we can restart the waiters and keep watching for
events.
This commit is contained in:
Jonathan Gold
2017-11-28 17:23:19 -05:00
committed by James Shubin
parent 08e7caea6b
commit 149a2188e2

View File

@@ -471,6 +471,9 @@ func (obj *AwsEc2Res) longpollWatch() error {
if aerr.Code() == request.CanceledErrorCode {
log.Printf("%s: Request cancelled", obj)
}
if aerr.Code() == request.WaiterResourceNotReadyErrorCode {
continue
}
}
select {
case obj.awsChan <- &chanStruct{
@@ -546,6 +549,9 @@ func (obj *AwsEc2Res) longpollWatch() error {
if aerr.Code() == request.CanceledErrorCode {
log.Printf("%s: Request cancelled", obj)
}
if aerr.Code() == request.WaiterResourceNotReadyErrorCode {
continue
}
}
select {
case obj.awsChan <- &chanStruct{
@@ -586,6 +592,9 @@ func (obj *AwsEc2Res) longpollWatch() error {
if aerr.Code() == request.CanceledErrorCode {
log.Printf("%s: Request cancelled", obj)
}
if aerr.Code() == request.WaiterResourceNotReadyErrorCode {
continue
}
}
select {
case obj.awsChan <- &chanStruct{