Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #4116 from parryjacob/4112-allow-remove-unknown
Browse files Browse the repository at this point in the history
Ignore "unknown instance" error when rm instance
  • Loading branch information
nathanleclaire authored Jun 2, 2017
2 parents d889abc + fc0fe0e commit 4c51397
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/amazonec2/amazonec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,12 @@ func (d *Driver) terminate() error {
_, err := d.getClient().TerminateInstances(&ec2.TerminateInstancesInput{
InstanceIds: []*string{&d.InstanceId},
})

if strings.HasPrefix(err.Error(), "unknown instance") {
log.Warn("Remote instance does not exist, proceeding with removing local reference")
return nil
}

if err != nil {
return fmt.Errorf("unable to terminate instance: %s", err)
}
Expand Down

0 comments on commit 4c51397

Please sign in to comment.