From: Kefu Chai Date: Fri, 26 Oct 2018 06:18:34 +0000 (+0800) Subject: orchestra.run: log the ssh command without prefix X-Git-Tag: 1.1.0~289^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1230%2Fhead;p=teuthology.git orchestra.run: log the ssh command without prefix 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 --- diff --git a/teuthology/orchestra/run.py b/teuthology/orchestra/run.py index 7a0fe1606..49266b891 100644 --- a/teuthology/orchestra/run.py +++ b/teuthology/orchestra/run.py @@ -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) = \