From 91670e44b784a18bb0fb454d3b7bf4df1432a7e0 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 26 Oct 2018 14:18:34 +0800 Subject: [PATCH] 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 --- teuthology/orchestra/run.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) = \ -- 2.47.3