forked from ungleich-public/cdist
Rm stderr debug output, stderr is not captured.
This commit is contained in:
parent
7c55364cc2
commit
2eab9b9598
3 changed files with 14 additions and 10 deletions
|
@ -220,7 +220,8 @@ class Local(object):
|
||||||
if save_output:
|
if save_output:
|
||||||
output, errout = exec_util.call_get_output(command, env=env)
|
output, errout = exec_util.call_get_output(command, env=env)
|
||||||
self.log.debug("Local stdout: {}".format(output))
|
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:
|
if return_output:
|
||||||
return output.decode()
|
return output.decode()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -173,7 +173,8 @@ class Remote(object):
|
||||||
try:
|
try:
|
||||||
output, errout = exec_util.call_get_output(command, env=os_environ)
|
output, errout = exec_util.call_get_output(command, env=os_environ)
|
||||||
self.log.debug("Remote stdout: {}".format(output))
|
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:
|
if return_output:
|
||||||
return output.decode()
|
return output.decode()
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|
|
@ -26,9 +26,6 @@ from tempfile import TemporaryFile
|
||||||
import cdist
|
import cdist
|
||||||
|
|
||||||
|
|
||||||
STDERR_UNSUPPORTED = '<Not yet supported>'
|
|
||||||
|
|
||||||
|
|
||||||
# IMPORTANT:
|
# IMPORTANT:
|
||||||
# with the code below in python 3.5 when command is executed and error
|
# with the code below in python 3.5 when command is executed and error
|
||||||
# occurs then stderr is not captured.
|
# occurs then stderr is not captured.
|
||||||
|
@ -126,16 +123,21 @@ def call_get_output(command, env=None):
|
||||||
|
|
||||||
assert isinstance(command, (list, tuple)), (
|
assert isinstance(command, (list, tuple)), (
|
||||||
"list or tuple argument expected, got: {}".format(command))
|
"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):
|
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) +
|
raise cdist.Error("Command failed: " + " ".join(command) +
|
||||||
(" with returncode: {}\n"
|
(" with returncode: {}\n"
|
||||||
"stdout: {}\n"
|
"stdout: {}").format(
|
||||||
"stderr: {}").format(
|
err.returncode, err.output))
|
||||||
err.returncode, err.output, errout))
|
|
||||||
|
|
||||||
|
|
||||||
def _call_get_stdout(command, env=None):
|
def _call_get_stdout(command, env=None):
|
||||||
|
|
Loading…
Reference in a new issue