Yaniv Bronhaim has uploaded a new change for review.

Change subject: webadmin, core: Return specific provider authentication error
......................................................................

webadmin, core: Return specific provider authentication error

On addProvider form the user fills authentication parameters to
communicate with external provider.
This patch adds more detailed warning message if the parameters are
wrong and the authentication failed.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1113000
Change-Id: Ia8d6540b115454cfd2aa055ba711694f74855164
Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com>i
Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/provider/foreman/ForemanHostProviderProxy.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
M backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
7 files changed, 13 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/33063/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/provider/foreman/ForemanHostProviderProxy.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/provider/foreman/ForemanHostProviderProxy.java
index 5904bd8..38af618 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/provider/foreman/ForemanHostProviderProxy.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/provider/foreman/ForemanHostProviderProxy.java
@@ -344,10 +344,12 @@
         try {
             int result = httpClient.executeMethod(httpMethod);
 
+            if (result == HttpURLConnection.HTTP_UNAUTHORIZED) {
+                throw new 
VdcBLLException(VdcBllErrors.PROVIDER_AUTHENTICATION_FAILURE);
+            }
+
             // after post request the return value is HTTP_MOVED_TEMP on 
success
             if (result != HttpURLConnection.HTTP_OK && result != 
HttpURLConnection.HTTP_MOVED_TEMP) {
-                // check other results and report better.
-                // 422: conflicts in data
                 throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE);
             }
         } catch (HttpException e) {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
index 382ca11..c02dd36 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
@@ -435,6 +435,7 @@
     FAILED_UPDATE_RUNNING_VM(5053),
     VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE(5054),
     VM_HOST_CANNOT_LIVE_MERGE(5055),
+    PROVIDER_AUTHENTICATION_FAILURE(5056),
 
     // Network Labels
     LABELED_NETWORK_INTERFACE_NOT_FOUND(5200),
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
index 48f1809..75bbb9c 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
@@ -389,6 +389,7 @@
 PROVIDER_FAILURE=Failed to communicate with the external provider.
 PROVIDER_IMPORT_CERTIFICATE_CHAIN_ERROR=Failed to import provider certificate 
chain.
 PROVIDER_SSL_FAILURE=SSL problem while trying to connect to the external 
provider.
+PROVIDER_AUTHENTICATION_FAILURE=Failed to authenticate with the external 
provider. Please confirm username and password.
 FAILED_UPDATE_RUNNING_VM=Failed to update VM while it is running, please try 
again when the VM is Down.
 VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE=To merge snapshots, a VM must be Down, Up 
or Paused.
 VM_HOST_CANNOT_LIVE_MERGE=The host on which this VM is running does not 
support live merging snapshots.
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
index b8e2e2d..1e9c50e 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java
@@ -651,6 +651,8 @@
 
     String PROVIDER_SSL_FAILURE();
 
+    String PROVIDER_AUTHENTICATION_FAILURE();
+
     String FAILED_UPDATE_RUNNING_VM();
 
     String PROVIDER_IMPORT_CERTIFICATE_CHAIN_ERROR();
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
index 0f8351b..b2dd502 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
@@ -431,10 +431,10 @@
     private void setTestResultValue(VdcReturnValueBase result) {
         String errorMessage = EMPTY_ERROR_MESSAGE;
         if (result == null || !result.getSucceeded()) {
-            if ((Boolean) requiresAuthentication.getEntity() && 
StringHelper.isNullOrEmpty(keystoneUrl)) {
-                errorMessage = 
ConstantsManager.getInstance().getConstants().noAuthUrl();
-            } else if (result != null) {
+            if (result != null) {
                 errorMessage = 
Frontend.getInstance().translateVdcFault(result.getFault());
+            } else if ((Boolean) requiresAuthentication.getEntity() && 
StringHelper.isNullOrEmpty(keystoneUrl)) {
+                errorMessage = 
ConstantsManager.getInstance().getConstants().noAuthUrl();
             } else {
                 errorMessage = 
ConstantsManager.getInstance().getConstants().testFailedUnknownErrorMsg();
             }
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
index 2965597..a700446 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
@@ -324,6 +324,7 @@
 PROVIDER_FAILURE=Failed to communicate with the external provider.
 PROVIDER_IMPORT_CERTIFICATE_CHAIN_ERROR=Failed to import provider certificate 
chain.
 PROVIDER_SSL_FAILURE=SSL problem while trying to connect to the external 
provider.
+PROVIDER_AUTHENTICATION_FAILURE=Failed to authenticate with the external 
provider. Please confirm username and passowrd.
 FAILED_UPDATE_RUNNING_VM=Failed to update VM while it is running, please try 
again when the VM is Down.
 VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE=To merge snapshots, a VM must be Down, Up 
or Paused.
 VM_HOST_CANNOT_LIVE_MERGE=The host on which this VM is running does not 
support live merging snapshots.
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
index 48aa4a7..1f17d2e 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
@@ -324,6 +324,7 @@
 PROVIDER_FAILURE=Failed to communicate with the external provider.
 PROVIDER_IMPORT_CERTIFICATE_CHAIN_ERROR=Failed to import provider certificate 
chain.
 PROVIDER_SSL_FAILURE=SSL problem while trying to connect to the external 
provider.
+PROVIDER_AUTHENTICATION_FAILURE=Failed to authenticate with the external 
provider. Please confirm username and passowrd.
 FAILED_UPDATE_RUNNING_VM=Failed to update VM while it is running, please try 
again when the VM is Down.
 VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE=To merge snapshots, a VM must be Down, Up 
or Paused.
 VM_HOST_CANNOT_LIVE_MERGE=The host on which this VM is running does not 
support live merging snapshots.


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8d6540b115454cfd2aa055ba711694f74855164
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Yaniv Bronhaim <ybron...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to