Skip to content

Commit

Permalink
Merge pull request coinbase#62 from Stovoy/steve/fix-detach-error-issue
Browse files Browse the repository at this point in the history
Fix DetachError issue
  • Loading branch information
Graham Jenson authored Apr 20, 2020
2 parents 181e352 + d5390e6 commit 93699b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 1 addition & 7 deletions deployer/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@ func StateMachine() (*machine.StateMachine, error) {
"Comment": "Detach Old ASGs",
"Next": "WaitDetachForFailure",
"Retry": [{
"Comment": "Retry on Detach Error",
"ErrorEquals": ["DetachError"],
"MaxAttempts": 6,
"IntervalSeconds": 10,
"BackoffRate": 1.0
},{
"Comment": "Keep trying to Clean",
"ErrorEquals": ["States.ALL"],
"MaxAttempts": 3,
Expand All @@ -212,7 +206,7 @@ func StateMachine() (*machine.StateMachine, error) {
"WaitDetachForFailure": {
"Comment": "Give detach a little time to do what it does",
"Type": "Wait",
"Seconds" : 5,
"Seconds" : 60,
"Next": "CleanUpFailure"
},
"CleanUpFailure": {
Expand Down
12 changes: 11 additions & 1 deletion deployer/models/release_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,17 @@ func (release *Release) DetachForFailure(asgc aws.ASGAPI) error {
}

if err := release.DetachAllASGs(asgc, asgs); err != nil {
return err
switch err.(type) {
case DetachError:
// Detached isn't finished yet. We don't care to wait for it to finish in this DetachForFailure state,
// so we'll just continue.
// Don't set this error on the release object as to not overwrite the other error.
// We may need to do something for other errors here. They'd overwrite as well, but
// are unexpected errors that we don't want to just drop.
return nil
default:
return err
}
}

return nil
Expand Down

0 comments on commit 93699b7

Please sign in to comment.