]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
orchestra.run: log the ssh command without prefix 1230/head
authorKefu Chai <kchai@redhat.com>
Fri, 26 Oct 2018 06:18:34 +0000 (14:18 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 27 Oct 2018 02:38:28 +0000 (10:38 +0800)
run() also supports single string, but if we pass a longstring literal
which contains "\n", it renders log difficult to read.
in this change, multi-line command is logged in multiple lines,
and print the "prefix" in the first line, then print the command in
following lines without "prefix".

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
teuthology/orchestra/run.py

index 7a0fe160658621eed0c9363665ce7884d65a21a0..49266b891099ac36f55c2a34bfefcf30e4e48ae1 100644 (file)
@@ -90,8 +90,9 @@ class RemoteProcess(object):
         prefix = "Running:"
         if self.label:
             prefix = "Running ({label}):".format(label=self.label)
-        log.getChild(self.hostname).info(u"{prefix} {cmd!r}".format(
-            cmd=self.command, prefix=prefix))
+        log.getChild(self.hostname).info(prefix)
+        for line in self.command.split('\n'):
+            log.getChild(self.hostname).info('> %s' % line)
 
         if hasattr(self, 'timeout'):
             (self._stdin_buf, self._stdout_buf, self._stderr_buf) = \