Skip to content

Commit

Permalink
fix(snapshots): ignore not found in delete operation (#3793)
Browse files Browse the repository at this point in the history
  • Loading branch information
emjburns committed Jun 17, 2019
1 parent 8d33935 commit 421d7f3
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.netflix.spinnaker.clouddriver.aws.deploy.ops;

import com.amazonaws.services.ec2.model.AmazonEC2Exception;
import com.amazonaws.services.ec2.model.DeleteSnapshotRequest;
import com.netflix.spectator.api.Id;
import com.netflix.spectator.api.Registry;
Expand Down Expand Up @@ -62,6 +63,13 @@ public Void operate(List priorOutputs) {
amazonClientProvider
.getAmazonEC2(description.getCredentials(), description.getRegion())
.deleteSnapshot(new DeleteSnapshotRequest().withSnapshotId(description.getSnapshotId()));
} catch (AmazonEC2Exception e) {
if (e.getStatusCode() == 400
&& e.getErrorCode().equalsIgnoreCase("InvalidSnapshot.NotFound")) {
log.debug("Snapshot does not exist, ignoring.");
} else {
throw e;
}
} catch (Exception e) {
registry
.counter(
Expand Down

0 comments on commit 421d7f3

Please sign in to comment.