]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume process.call add conditional verbosity on failure
authorAlfredo Deza <adeza@redhat.com>
Thu, 29 Mar 2018 12:58:14 +0000 (08:58 -0400)
committerAlfredo Deza <alfredo@deza.pe>
Thu, 19 Apr 2018 16:31:21 +0000 (12:31 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 50c9d5331b0c42d568baa47a2d52f199b3b4d818)

src/ceph-volume/ceph_volume/process.py

index 501c830d99cbceff5c481145d6696b7874eab425..4bedb134f8d25b0c5ece60f95ea91916ed1866db 100644 (file)
@@ -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