[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lnst-developers
Subject:    [PATCH] XmlProccessing: no password bug fix
From:       olichtne () redhat ! com (olichtne at redhat ! com)
Date:       2012-09-24 7:13:21
Message-ID: 1348470801-31449-1-git-send-email-olichtne () redhat ! com
[Download RAW message or body]

From: Ondrej Lichtner <olichtne at redhat.com>

Machine passwords are optional, however not specifying one causes the
controller crash with an undescriptive error message. This is caused by
the fact that in these cases None value is used instead of the password.

This commit changes that by using an empty string as the password when
it isn't specified in the recipe.

I also changed the error message for failed password authentification,
so that it is more clear that the password failed.

Signed-off-by: Ondrej Lichtner <olichtne at redhat.com>
---
 Common/SshUtils.py           | 7 ++++---
 NetTest/NetTestController.py | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Common/SshUtils.py b/Common/SshUtils.py
index 340f119..f44f603 100644
--- a/Common/SshUtils.py
+++ b/Common/SshUtils.py
@@ -58,7 +58,8 @@ class SCPError(Exception):
         self.output = output
 
     def __str__(self):
-        return "%s    (output: %r)" % (self.msg, self.output)
+        indented = "\n".join((4 * " ") + i for i in self.output.splitlines())
+        return "%s%s" % (self.msg, indented)
 
 
 class SCPAuthenticationError(SCPError):
@@ -127,7 +128,7 @@ def _remote_login(session, username, password, prompt, timeout=10):
                     password_prompt_count += 1
                     continue
                 else:
-                    raise LoginAuthenticationError("Got password prompt twice",
+                    raise LoginAuthenticationError("Invalid password",
                                                    text)
             elif match == 2:  # "login:"
                 if login_prompt_count == 0 and password_prompt_count == 0:
@@ -294,7 +295,7 @@ def _remote_scp(session, password_list, transfer_timeout=600, login_timeout=10):
                     authentication_done = True
                     continue
                 else:
-                    raise SCPAuthenticationError("Got password prompt twice",
+                    raise SCPAuthenticationError("Invalid password",
                                                  text)
             elif match == 2:  # "lost connection"
                 raise SCPError("SCP client said 'lost connection'", text)
diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py
index 526a3e7..e9735b4 100644
--- a/NetTest/NetTestController.py
+++ b/NetTest/NetTestController.py
@@ -227,7 +227,7 @@ class NetTestController:
         if "rootpass" in info:
             passwd = info["rootpass"]
         else:
-            passwd = None
+            passwd = ''
         logging.info("Remote app exec on machine %s", hostname)
 
         port = "22"
-- 
1.7.11.4


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic