From f3c77d013c0d2662316edcb671204a813aa40544 Mon Sep 17 00:00:00 2001
From: rexlee8776 <limingjiang@huawei.com>
Date: Wed, 6 Jul 2016 04:09:24 +0000
Subject: fix the ssh bug when run tc043 in CI

Change-Id: I93ffe038ee128976db001e4f2ece79366aa3826c
Signed-off-by: rexlee8776 <limingjiang@huawei.com>
---
 yardstick/benchmark/scenarios/networking/ping.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py
index 3af354850..08755a08b 100644
--- a/yardstick/benchmark/scenarios/networking/ping.py
+++ b/yardstick/benchmark/scenarios/networking/ping.py
@@ -41,11 +41,17 @@ class Ping(base.Scenario):
         user = host.get('user', 'ubuntu')
         ip = host.get('ip', None)
         key_filename = host.get('key_filename', '/root/.ssh/id_rsa')
-        password = host.get('password', 'root')
+        password = host.get('password', None)
+
+        if password is not None:
+            LOG.info("Log in via pw, user:%s, host:%s, pw:%s",
+                     user, ip, password)
+            self.connection = ssh.SSH(user, ip, password=password)
+        else:
+            LOG.info("Log in via key, user:%s, host:%s, key_filename:%s",
+                     user, ip, key_filename)
+            self.connection = ssh.SSH(user, ip, key_filename=key_filename)
 
-        LOG.info("user:%s, host:%s, key_filename:%s", user, ip, key_filename)
-        self.connection = ssh.SSH(user, ip, key_filename=key_filename,
-                                  password=password)
         self.connection.wait()
 
     def run(self, result):
-- 
cgit