Skip to content

Commit

Permalink
feat(provider/aws): Remove ability to automatically remove dependenci…
Browse files Browse the repository at this point in the history
…es when deleting a security group (spinnaker#1894)
  • Loading branch information
Justin Reynolds authored and chlung committed Sep 15, 2017
1 parent 939bccf commit 6ec4d53
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ class DeleteSecurityGroupDescription extends AbstractAmazonCredentialsDescriptio
String securityGroupName
String vpcId
Set<String> regions
Boolean removeDependencies
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,38 +109,7 @@ class DeleteSecurityGroupAtomicOperation implements AtomicOperation<Void> {
}
}
}

// Try to clear dependency violations
if (description.removeDependencies && securityGroupToRevokeIngressPermissions.size() > 0) {
// We only support removing ingress rules right now.
// Revoke ingress rules that contain this security group
securityGroupToRevokeIngressPermissions.each { entry ->
RevokeSecurityGroupIngressRequest req = new RevokeSecurityGroupIngressRequest(groupId: entry.key.groupId, ipPermissions: entry.value)
try {
ec2.revokeSecurityGroupIngress(req)
} catch (AmazonServiceException ase) {
task.updateStatus BASE_PHASE, ase.errorMessage
}
}

// Try to delete the security group one more time
// We need to retry a couple times because the ingress revoke has some propagation delay
// and we might be trying to delete it too soon
try {
OperationPoller.retryWithBackoff({ o ->
ec2.deleteSecurityGroup(request)
}, 1000, 2)
} catch (AmazonServiceException ase) {
if (e.errorCode == "DependencyViolation") {
this.generateDependencyError(e, task, securityGroupToRevokeIngressPermissions)
} else if (e.errorCode != "InvalidGroup.NotFound") {
task.updateStatus BASE_PHASE, ase.errorMessage
throw ase
}
}
} else {
this.generateDependencyError(e, task, securityGroupToRevokeIngressPermissions)
}
this.generateDependencyError(e, task, securityGroupToRevokeIngressPermissions)
} else if (e.errorCode != "InvalidGroup.NotFound") {
task.updateStatus BASE_PHASE, e.errorMessage
throw e
Expand Down

0 comments on commit 6ec4d53

Please sign in to comment.