Fix SGE.removeSecurityGroup for when the SG doesn't exist

This commit is contained in:
Svetoslav Neykov 2017-07-06 10:51:27 +03:00
parent f086c050f9
commit cb556428e3
1 changed files with 9 additions and 1 deletions

View File

@ -190,7 +190,15 @@ public class AzureComputeSecurityGroupExtension implements SecurityGroupExtensio
final ResourceGroupAndName resourceGroupAndName = ResourceGroupAndName.fromSlashEncoded(id); final ResourceGroupAndName resourceGroupAndName = ResourceGroupAndName.fromSlashEncoded(id);
URI uri = api.getNetworkSecurityGroupApi(resourceGroupAndName.resourceGroup()) URI uri = api.getNetworkSecurityGroupApi(resourceGroupAndName.resourceGroup())
.delete(resourceGroupAndName.name()); .delete(resourceGroupAndName.name());
return resourceDeleted.apply(uri);
// https://docs.microsoft.com/en-us/rest/api/network/virtualnetwork/delete-a-network-security-group
if (uri != null) {
// 202-Accepted if resource exists and the request is accepted.
return resourceDeleted.apply(uri);
} else {
// 204-No Content if resource does not exist.
return false;
}
} }
@Override @Override