cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys
Date Fri, 20 Apr 2018 13:24:00 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16445712#comment-16445712
] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
---------------------------------------------

rhtyd commented on a change in pull request #2377: CLOUDSTACK-10207: updateVpnCustomerGateway:
fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183048444
 
 

 ##########
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##########
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway updateCustomerGateway(UpdateVpnCustomerGatewayCm
                 }
             }
         }
-        String name = cmd.getName();
         String gatewayIp = cmd.getGatewayIp();
         if (!NetUtils.isValidIp(gatewayIp) && !NetUtils.verifyDomainName(gatewayIp))
{
             throw new InvalidParameterValueException("The customer gateway ip/Domain " +
gatewayIp + " is invalid!");
         }
-        if (name == null) {
-            name = "VPN-" + gatewayIp;
-        }
         String guestCidrList = cmd.getGuestCidrList();
         if (!NetUtils.isValidCidrList(guestCidrList)) {
             throw new InvalidParameterValueException("The customer gateway peer cidr list
" + guestCidrList + " contains an invalid cidr!");
         }
-        String ipsecPsk = cmd.getIpsecPsk();
         String ikePolicy = cmd.getIkePolicy();
-        String espPolicy = cmd.getEspPolicy();
         if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-            throw new InvalidParameterValueException("The customer gateway IKE policy" +
ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) group is specified.");
+            throw new InvalidParameterValueException("Error while updating a customer gateway.
The IKE policy" + ikePolicy + " is invalid! Verify whether the required Diffie Hellman (DH)
group is specified.");
         }
+        String espPolicy = cmd.getEspPolicy();
         if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
             throw new InvalidParameterValueException("The customer gateway ESP policy" +
espPolicy + " is invalid!");
         }
         Long ikeLifetime = cmd.getIkeLifetime();
-        if (ikeLifetime == null) {
-            // Default value of lifetime is 1 day
-            ikeLifetime = (long)86400;
-        }
-        if (ikeLifetime > 86400) {
+        if (ikeLifetime != null && ikeLifetime > 86400) {
             throw new InvalidParameterValueException("The IKE lifetime " + ikeLifetime +
" of vpn connection is invalid!");
         }
         Long espLifetime = cmd.getEspLifetime();
-        if (espLifetime == null) {
-            // Default value of lifetime is 1 hour
-            espLifetime = (long)3600;
-        }
-        if (espLifetime > 86400) {
+        if (espLifetime != null && espLifetime > 86400) {
             throw new InvalidParameterValueException("The ESP lifetime " + espLifetime +
" of vpn connection is invalid!");
         }
 
-        Boolean dpd = cmd.getDpd();
-        if (dpd == null) {
-            dpd = false;
-        }
-
-        Boolean encap = cmd.getEncap();
-        if (encap == null) {
-            encap = false;
-        }
-
         checkCustomerGatewayCidrList(guestCidrList);
 
-        long accountId = gw.getAccountId();
-        Site2SiteCustomerGatewayVO existedGw = _customerGatewayDao.findByNameAndAccountId(name,
accountId);
-        if (existedGw != null && existedGw.getId() != gw.getId()) {
-            throw new InvalidParameterValueException("The customer gateway with name " +
name + " already existed!");
+        String name = cmd.getName();
+        if (name != null) {
 
 Review comment:
   I see you've a null check here, but what is name is not provided, the code will fallthrough?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -------------------------------------------------------------
>
>                 Key: CLOUDSTACK-10207
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: API
>            Reporter: René Moser
>            Assignee: René Moser
>            Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message