From: Alfredo Deza Date: Thu, 29 Mar 2018 12:58:14 +0000 (-0400) Subject: ceph-volume process.call add conditional verbosity on failure X-Git-Tag: v12.2.5~5^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fa71de158e2cabad479a7aea06318658b2f26f64;p=ceph.git ceph-volume process.call add conditional verbosity on failure Signed-off-by: Alfredo Deza (cherry picked from commit 50c9d5331b0c42d568baa47a2d52f199b3b4d818) --- diff --git a/src/ceph-volume/ceph_volume/process.py b/src/ceph-volume/ceph_volume/process.py index 501c830d99cb..4bedb134f8d2 100644 --- a/src/ceph-volume/ceph_volume/process.py +++ b/src/ceph-volume/ceph_volume/process.py @@ -173,9 +173,12 @@ def call(command, **kw): :param terminal_verbose: Log command output to terminal, defaults to False, and it is forcefully set to True if a return code is non-zero :param logfile_verbose: Log stderr/stdout output to log file. Defaults to True + :param verbose_on_failure: On a non-zero exit status, it will forcefully set logging ON for + the terminal. Defaults to True """ terminal_verbose = kw.pop('terminal_verbose', False) logfile_verbose = kw.pop('logfile_verbose', True) + verbose_on_failure = kw.pop('verbose_on_failure', True) show_command = kw.pop('show_command', False) executable = which(command.pop(0)) command.insert(0, executable) @@ -208,8 +211,11 @@ def call(command, **kw): if returncode != 0: # set to true so that we can log the stderr/stdout that callers would - # do anyway - terminal_verbose = True + # do anyway as long as verbose_on_failure is set (defaults to True) + if verbose_on_failure: + terminal_verbose = True + # logfiles aren't disruptive visually, unlike the terminal, so this + # should always be on when there is a failure logfile_verbose = True # the following can get a messed up order in the log if the system call