mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CS-15512: Fix delete vpn connection
This commit is contained in:
parent
c2f9417de4
commit
ade3ae4e3c
@ -100,8 +100,8 @@ public class DeleteVpnConnectionCmd extends BaseAsyncCmd {
|
||||
@Override
|
||||
public void execute(){
|
||||
try {
|
||||
Site2SiteVpnConnection result = _s2sVpnService.deleteVpnConnection(this);
|
||||
if (result != null) {
|
||||
boolean result = _s2sVpnService.deleteVpnConnection(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
|
||||
@ -98,8 +98,8 @@ public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd {
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
Site2SiteCustomerGateway result = _s2sVpnService.deleteCustomerGateway(this);
|
||||
if (result != null) {
|
||||
boolean result = _s2sVpnService.deleteCustomerGateway(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
|
||||
@ -100,8 +100,8 @@ public class DeleteVpnGatewayCmd extends BaseAsyncCmd {
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
Site2SiteVpnGateway result = _s2sVpnService.deleteVpnGateway(this);
|
||||
if (result != null) {
|
||||
boolean result = _s2sVpnService.deleteVpnGateway(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
|
||||
@ -38,9 +38,9 @@ public interface Site2SiteVpnService {
|
||||
Site2SiteVpnConnection startVpnConnection(long id) throws ResourceUnavailableException;
|
||||
IpAddress getVpnGatewayIp(Long vpnGatewayId);
|
||||
Site2SiteVpnConnection createVpnConnection(CreateVpnConnectionCmd cmd) throws NetworkRuleConflictException;
|
||||
Site2SiteCustomerGateway deleteCustomerGateway(DeleteVpnCustomerGatewayCmd deleteVpnCustomerGatewayCmd);
|
||||
Site2SiteVpnGateway deleteVpnGateway(DeleteVpnGatewayCmd deleteVpnGatewayCmd);
|
||||
Site2SiteVpnConnection deleteVpnConnection(DeleteVpnConnectionCmd deleteVpnConnectionCmd) throws ResourceUnavailableException;
|
||||
boolean deleteCustomerGateway(DeleteVpnCustomerGatewayCmd deleteVpnCustomerGatewayCmd);
|
||||
boolean deleteVpnGateway(DeleteVpnGatewayCmd deleteVpnGatewayCmd);
|
||||
boolean deleteVpnConnection(DeleteVpnConnectionCmd deleteVpnConnectionCmd) throws ResourceUnavailableException;
|
||||
Site2SiteVpnConnection resetVpnConnection(ResetVpnConnectionCmd resetVpnConnectionCmd) throws ResourceUnavailableException;
|
||||
List<Site2SiteCustomerGateway> searchForCustomerGateways(ListVpnCustomerGatewaysCmd listVpnCustomerGatewaysCmd);
|
||||
List<Site2SiteVpnGateway> searchForVpnGateways(ListVpnGatewaysCmd listVpnGatewaysCmd);
|
||||
|
||||
@ -183,25 +183,25 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnService, Manager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Site2SiteCustomerGateway deleteCustomerGateway(DeleteVpnCustomerGatewayCmd cmd) {
|
||||
public boolean deleteCustomerGateway(DeleteVpnCustomerGatewayCmd cmd) {
|
||||
Long id = cmd.getId();
|
||||
Site2SiteCustomerGateway customerGateway = _customerGatewayDao.findById(id);
|
||||
if (customerGateway == null) {
|
||||
throw new InvalidParameterValueException("Fail to find customer gateway with " + id + " !");
|
||||
}
|
||||
_customerGatewayDao.remove(id);
|
||||
return customerGateway;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Site2SiteVpnGateway deleteVpnGateway(DeleteVpnGatewayCmd cmd) {
|
||||
public boolean deleteVpnGateway(DeleteVpnGatewayCmd cmd) {
|
||||
Long id = cmd.getId();
|
||||
Site2SiteVpnGateway vpnGateway = _vpnGatewayDao.findById(id);
|
||||
if (vpnGateway == null) {
|
||||
throw new InvalidParameterValueException("Fail to find vpn gateway with " + id + " !");
|
||||
}
|
||||
_vpnGatewayDao.remove(id);
|
||||
return vpnGateway;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -252,7 +252,7 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnService, Manager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Site2SiteVpnConnection deleteVpnConnection(DeleteVpnConnectionCmd cmd) throws ResourceUnavailableException {
|
||||
public boolean deleteVpnConnection(DeleteVpnConnectionCmd cmd) throws ResourceUnavailableException {
|
||||
Long id = cmd.getId();
|
||||
Site2SiteVpnConnectionVO conn = _vpnConnectionDao.findById(id);
|
||||
if (conn == null) {
|
||||
@ -262,7 +262,7 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnService, Manager {
|
||||
stopVpnConnection(id);
|
||||
}
|
||||
_vpnConnectionDao.remove(id);
|
||||
return conn;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void stopVpnConnection(Long id) throws ResourceUnavailableException {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user