From 2eab9b9598c62a50ffc71f02029ab0e8db199667 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Fri, 15 Jul 2016 08:22:05 +0200 Subject: [PATCH] Rm stderr debug output, stderr is not captured. --- cdist/exec/local.py | 3 ++- cdist/exec/remote.py | 3 ++- cdist/exec/util.py | 18 ++++++++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index e2d07e8d..d115bf24 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -220,7 +220,8 @@ class Local(object): if save_output: output, errout = exec_util.call_get_output(command, env=env) self.log.debug("Local stdout: {}".format(output)) - self.log.debug("Local stderr: {}".format(errout)) + # Currently, stderr is not captured. + # self.log.debug("Local stderr: {}".format(errout)) if return_output: return output.decode() else: diff --git a/cdist/exec/remote.py b/cdist/exec/remote.py index ff388e1d..b6ff8c1f 100644 --- a/cdist/exec/remote.py +++ b/cdist/exec/remote.py @@ -173,7 +173,8 @@ class Remote(object): try: output, errout = exec_util.call_get_output(command, env=os_environ) self.log.debug("Remote stdout: {}".format(output)) - self.log.debug("Remote stderr: {}".format(errout)) + # Currently, stderr is not captured. + # self.log.debug("Remote stderr: {}".format(errout)) if return_output: return output.decode() except subprocess.CalledProcessError as e: diff --git a/cdist/exec/util.py b/cdist/exec/util.py index 9c8ff48d..864a73a3 100644 --- a/cdist/exec/util.py +++ b/cdist/exec/util.py @@ -26,9 +26,6 @@ from tempfile import TemporaryFile import cdist -STDERR_UNSUPPORTED = '' - - # IMPORTANT: # with the code below in python 3.5 when command is executed and error # occurs then stderr is not captured. @@ -126,16 +123,21 @@ def call_get_output(command, env=None): assert isinstance(command, (list, tuple)), ( "list or tuple argument expected, got: {}".format(command)) - return (_call_get_stdout(command, env), STDERR_UNSUPPORTED) + return (_call_get_stdout(command, env), None) def handle_called_process_error(err, command): - errout = STDERR_UNSUPPORTED + # Currently, stderr is not captured. + # errout = None + # raise cdist.Error("Command failed: " + " ".join(command) + + # (" with returncode: {}\n" + # "stdout: {}\n" + # "stderr: {}").format( + # err.returncode, err.output, errout)) raise cdist.Error("Command failed: " + " ".join(command) + (" with returncode: {}\n" - "stdout: {}\n" - "stderr: {}").format( - err.returncode, err.output, errout)) + "stdout: {}").format( + err.returncode, err.output)) def _call_get_stdout(command, env=None):