From da56354aa3c18ff3b88848aaea9c1849c79f18d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 22 Jun 2021 16:02:54 +0200 Subject: [PATCH] ceph: run CLI output with Info logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In e8f9cfcb714685d93017be279d9ffdfc3847acca, the logging was replaced by Debug which is probably a mistake given the intent of the commit to enable debug logging on the prepare job. However, this code is only triggered when running a ceph-osd with the rook binary, so we must run Info and run Debug since Debug is not activated. Signed-off-by: Sébastien Han --- pkg/util/exec/exec.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/util/exec/exec.go b/pkg/util/exec/exec.go index 718b40632bcf..bed06788aca5 100644 --- a/pkg/util/exec/exec.go +++ b/pkg/util/exec/exec.go @@ -247,11 +247,16 @@ func startCommand(env []string, command string, arg ...string) (*exec.Cmd, io.Re // read from reader line by line and write it to the log func logFromReader(logger *capnslog.PackageLogger, reader io.ReadCloser) { + l := logger.Debug + // If we are an OSD we must log using Info to print out stdout/stderr + if os.Getenv("ROOK_OSD_ID") != "" { + l = logger.Info + } in := bufio.NewScanner(reader) lastLine := "" for in.Scan() { lastLine = in.Text() - logger.Debug(lastLine) + l(lastLine) } }