Kanagaraj M has uploaded a new change for review.

Change subject: webadmin: Fix import cluster fingerprint validation issues
......................................................................

webadmin: Fix import cluster fingerprint validation issues

Fingerprint will not be validated if either host address
or password is empty.

Change-Id: I63878f1430f80d672b2aec35685187a74c921b17
Bug-Url: https://bugzilla.redhat.com/887830
Signed-off-by: Kanagaraj M <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
1 file changed, 17 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/10/10610/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
index dc69e2a..7522838 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
@@ -757,6 +757,11 @@
             @Override
             public void eventRaised(Event ev, Object sender, EventArgs args) {
                 setIsFingerprintVerified(false);
+                if (getGlusterHostAddress().getEntity() == null
+                        || ((String) 
getGlusterHostAddress().getEntity()).trim().length() == 0) {
+                    getGlusterHostFingerprint().setEntity(""); //$NON-NLS-1$
+                    return;
+                }
                 fetchFingerprint((String) getGlusterHostAddress().getEntity());
             }
         });
@@ -1070,11 +1075,16 @@
                             || ((Boolean) 
getEnableGlusterService().getEntity());
         }
 
+        getGlusterHostAddress().ValidateEntity(new IValidation[] { new 
NotEmptyValidation() });
+        getGlusterHostPassword().ValidateEntity(new IValidation[] { new 
NotEmptyValidation() });
+
         if (!validService)
         {
             
setMessage(ConstantsManager.getInstance().getConstants().clusterServiceValidationMsg());
         }
-        else if (((Boolean) getIsImportGlusterConfiguration().getEntity()) && 
!isFingerprintVerified())
+        else if (((Boolean) getIsImportGlusterConfiguration().getEntity()) && 
getGlusterHostAddress().getIsValid()
+                && getGlusterHostPassword().getIsValid()
+                && !isFingerprintVerified())
         {
             
setMessage(ConstantsManager.getInstance().getConstants().fingerprintNotVerified());
         }
@@ -1083,18 +1093,19 @@
             setMessage(null);
         }
 
-        getGlusterHostAddress().ValidateEntity(new IValidation[] { new 
NotEmptyValidation() });
-        getGlusterHostPassword().ValidateEntity(new IValidation[] { new 
NotEmptyValidation() });
-
         setIsGeneralTabValid(getName().getIsValid() && 
getDataCenter().getIsValid() && getCPU().getIsValid()
                 && getVersion().getIsValid() && validService && 
getGlusterHostAddress().getIsValid()
                 && getGlusterHostPassword().getIsValid()
-                && ((Boolean) getIsImportGlusterConfiguration().getEntity() ? 
isFingerprintVerified() : true));
+                && ((Boolean) getIsImportGlusterConfiguration().getEntity() ? 
(getGlusterHostAddress().getIsValid()
+                        && getGlusterHostPassword().getIsValid()
+                        && isFingerprintVerified()) : true));
 
         return getName().getIsValid() && getDataCenter().getIsValid() && 
getCPU().getIsValid()
                 && getVersion().getIsValid() && validService && 
getGlusterHostAddress().getIsValid()
                 && getGlusterHostPassword().getIsValid()
-                && ((Boolean) getIsImportGlusterConfiguration().getEntity() ? 
isFingerprintVerified() : true);
+                && ((Boolean) getIsImportGlusterConfiguration().getEntity() ? 
(getGlusterHostAddress().getIsValid()
+                        && getGlusterHostPassword().getIsValid()
+                        && isFingerprintVerified()) : true);
     }
 
 }


--
To view, visit http://gerrit.ovirt.org/10610
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63878f1430f80d672b2aec35685187a74c921b17
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Kanagaraj M <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to