Yair Zaslavsky has uploaded a new change for review.

Change subject: tools: Provide better explaination on why setting password 
failed.
......................................................................

tools: Provide better explaination on why setting password failed.

Instead of providing the notes, a better error message is printed:
In case the admin-pass-file does not exist, a message indicating the
file does not exist will be printed.
In other cases, if the value is not "interactive" and the file does
not exist, a short message explaining the problem will be presented.

Bug-Url: https://bugzilla.redhat.com/1058957
Change-Id: I3cbfb4d8ff6cd3dc3a6bdb0b6664d5cfc8012b1a
Signed-off-by: Yair Zaslavsky <yzasl...@redhat.com>
---
M 
backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java
1 file changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/81/23981/1

diff --git 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java
 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java
index 95d1c88..7ada996 100644
--- 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java
+++ 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/entity/helper/PasswordValueHelper.java
@@ -113,10 +113,19 @@
             return new ValidationResult(true);
         }
         // or if we have the password in --admin-pass-file
-        if (StringUtils.isNotBlank(parser.getAdminPassFile()) && new 
File(parser.getAdminPassFile()).exists()) {
-            return new ValidationResult(true);
+        if (StringUtils.isNotBlank(parser.getAdminPassFile())) {
+            if (new File(parser.getAdminPassFile()).exists()) {
+                return new ValidationResult(true);
+            } else {
+                return new ValidationResult(false, String.format("The file 
%1$s does not exist. Cannot change password for %2$s",
+                                parser.getAdminPassFile(), key.getKey()));
+            }
         }
-        return new ValidationResult(false, getHelpNote(key));
+        return new ValidationResult(false,
+                String.format("It appears you tried to change a password for 
%1$s in a wrong way."
+                        +
+                        "You should use interactive mode or provide a file 
cotaining the password. Run the utility with --help for more information.",
+                        key.getKey()));
     }
 
     @Override


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3cbfb4d8ff6cd3dc3a6bdb0b6664d5cfc8012b1a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to