diff mbox

[v3,1/6] tests: remotehost.py use join

Message ID 1461906457-18455-1-git-send-email-janusz.dziedzic@tieto.com
State Accepted
Headers show

Commit Message

Janusz.Dziedzic@tieto.com April 29, 2016, 5:07 a.m. UTC
Use join instead of for.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 tests/hwsim/remotehost.py | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Jouni Malinen May 14, 2016, 5:09 p.m. UTC | #1
Thanks, all six patches applied.
Janusz.Dziedzic@tieto.com May 14, 2016, 6:27 p.m. UTC | #2
On 14 May 2016 at 19:09, Jouni Malinen <j@w1.fi> wrote:
> Thanks, all six patches applied.
>
Thanks!!!

BR
Janusz

> --
> Jouni Malinen                                            PGP id EFC895FA
diff mbox

Patch

diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py
index 213c2fc..6895fc2 100644
--- a/tests/hwsim/remotehost.py
+++ b/tests/hwsim/remotehost.py
@@ -11,6 +11,8 @@  import threading
 logger = logging.getLogger()
 
 def execute_thread(command, reply):
+    cmd = ' '.join(command)
+    logger.debug("thread run: " + cmd)
     try:
         status = 0;
         buf = subprocess.check_output(command, stderr=subprocess.STDOUT)
@@ -18,9 +20,6 @@  def execute_thread(command, reply):
         status = e.returncode
         buf = e.output
 
-    cmd = ""
-    for c in command:
-        cmd = cmd + " " + c
     logger.debug("thread cmd: " + cmd)
     logger.debug("thread exit status: " + str(status))
     logger.debug("thread exit buf: " + str(buf))
@@ -55,9 +54,7 @@  class Host():
             return self.local_execute(command)
 
         cmd = ["ssh", self.user + "@" + self.host, ' '.join(command)]
-        _cmd = self.name + " execute: "
-        for c in cmd:
-            _cmd = _cmd + " " + c
+        _cmd = self.name + " execute: " + ' '.join(cmd)
         logger.debug(_cmd)
         try:
             status = 0
@@ -76,9 +73,7 @@  class Host():
             cmd = command
         else:
             cmd = ["ssh",  self.user + "@" + self.host, ' '.join(command)]
-        _cmd = self.name + " execute_run: "
-        for c in cmd:
-            _cmd = _cmd + " " + c
+        _cmd = self.name + " execute_run: " + ' '.join(cmd)
         logger.debug(_cmd)
         t = threading.Thread(target = execute_thread, args=(cmd, res))
         t.start()