commit 28dede0a27e81a38965ab937b9a2481ef4ffba15
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Sep 24 09:13:21 2012 +0200
XmlProccessing: no password bug fix
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(a)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"