Skip to content

Commit

Permalink
Merge pull request openshift#2497 from wking/fail-slow-error-logging
Browse files Browse the repository at this point in the history
pkg/destroy/aws: Fix fail-slow error handling in deleteEC2SubnetByVPC
  • Loading branch information
openshift-merge-robot authored Oct 11, 2019
2 parents f0ad4e6 + 58524d5 commit 3f77881
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/destroy/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -1148,17 +1148,22 @@ func deleteEC2SubnetsByVPC(client *ec2.EC2, vpc string, failFast bool, logger lo
return err
}

var lastError error
for _, subnet := range results.Subnets {
err := deleteEC2Subnet(client, *subnet.SubnetId, logger.WithField("subnet", *subnet.SubnetId))
if err != nil {
err = errors.Wrapf(err, "deleting EC2 subnet %s", *subnet.SubnetId)
if failFast {
return err
}
if lastError != nil {
logger.Debug(lastError)
}
lastError = err
}
}

return nil
return lastError
}

func deleteEC2Volume(client *ec2.EC2, id string, logger logrus.FieldLogger) error {
Expand Down

0 comments on commit 3f77881

Please sign in to comment.