You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/08/20 11:16:26 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #5337: Bypass empty string check for username and password

DaanHoogland commented on a change in pull request #5337:
URL: https://github.com/apache/cloudstack/pull/5337#discussion_r692867216



##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -687,6 +688,10 @@ public Discoverer getMatchingDiscover(final Hypervisor.HypervisorType hypervisor
         if ((clusterName != null || clusterId != null) && podId == null) {
             throw new InvalidParameterValueException("Can't specify cluster without specifying the pod");
         }
+        if (!hypervisorType.equalsIgnoreCase(HypervisorType.VMware.toString()) &&
+                (Strings.isNullOrEmpty(username) || Strings.isNullOrEmpty(password))) {
+            throw new InvalidParameterValueException("Username and Password need to be provided.");
+        }

Review comment:
       maybe excessive but also a tat safer:
   ```suggestion
           if (!HypervisorType.VMware.toString().equalsIgnoreCase(hypervisorType) &&
                   (Strings.isNullOrEmpty(username) || Strings.isNullOrEmpty(password))) {
               throw new InvalidParameterValueException("Username and Password need to be provided.");
           }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org