Skip to content

Commit

Permalink
Update DeleteVPC() method
Browse files Browse the repository at this point in the history
  • Loading branch information
innodreamer committed Apr 17, 2024
1 parent 54773ee commit c72c722
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,16 @@ func (vpcHandler *NhnCloudVPCHandler) DeleteVPC(vpcIID irs.IID) (bool, error) {
return false, newErr
}

var subnetIDs []string
if len(vpc.Subnets) > 0 {
for _, subnet := range vpc.Subnets {
subnetIDs = append(subnetIDs, subnet.ID)
}
}

for _, subnetID := range subnetIDs {
if _, err := vpcHandler.RemoveSubnet(irs.IID{SystemId: vpcIID.SystemId}, irs.IID{SystemId: subnetID}); err != nil {
newErr := fmt.Errorf("Failed to Remove the Subnet with the SystemID. : [%s] : [%v]", subnetID, err)
cblogger.Error(newErr.Error())
LoggingError(callLogInfo, err)
return false, newErr
if _, err := vpcHandler.RemoveSubnet(irs.IID{SystemId: vpcIID.SystemId}, irs.IID{SystemId: subnet.ID}); err != nil {
newErr := fmt.Errorf("Failed to Remove the Subnet with the SystemID. : [%s] : [%v]", subnet.ID, err)
cblogger.Error(newErr.Error())
LoggingError(callLogInfo, err)
return false, newErr
}
time.Sleep(time.Second * 2)
}
time.Sleep(time.Second * 2)
}

delErr := vpcs.Delete(vpcHandler.NetworkClient, vpcIID.SystemId).ExtractErr()
Expand Down

0 comments on commit c72c722

Please sign in to comment.