Stop trying to log stdout when fetching logs during inspection
Logging the whole journalctl output is not the best idea. Fortunately, it does not work right now and fails with a traceback :) This change adds a new log_stdout argument to utils.execute() and uses it in the "logs" inspection collector. Also do not log the logs while logging the collected data. Change-Id: Ibc726ac2c4f5eb06c73ac4765bb400077b84a6cc
This commit is contained in:
ironic_python_agent
@ -53,15 +53,18 @@ def execute(*cmd, **kwargs):
|
||||
oslo_concurrency.processutils.execute for usage.
|
||||
|
||||
:param *cmd: positional arguments to pass to processutils.execute()
|
||||
:param log_stdout: keyword-only argument: whether to log the output
|
||||
:param **kwargs: keyword arguments to pass to processutils.execute()
|
||||
:raises: UnknownArgumentError on receiving unknown arguments
|
||||
:raises: ProcessExecutionError
|
||||
:raises: OSError
|
||||
:returns: tuple of (stdout, stderr)
|
||||
"""
|
||||
log_stdout = kwargs.pop('log_stdout', True)
|
||||
result = processutils.execute(*cmd, **kwargs)
|
||||
LOG.debug('Execution completed, command line is "%s"', ' '.join(cmd))
|
||||
LOG.debug('Command stdout is: "%s"', result[0])
|
||||
if log_stdout:
|
||||
LOG.debug('Command stdout is: "%s"', result[0])
|
||||
LOG.debug('Command stderr is: "%s"', result[1])
|
||||
return result
|
||||
|
||||
@ -76,6 +79,7 @@ def try_execute(*cmd, **kwargs):
|
||||
returns None in case of failure.
|
||||
|
||||
:param *cmd: positional arguments to pass to processutils.execute()
|
||||
:param log_stdout: keyword-only argument: whether to log the output
|
||||
:param **kwargs: keyword arguments to pass to processutils.execute()
|
||||
:raises: UnknownArgumentError on receiving unknown arguments
|
||||
:returns: tuple of (stdout, stderr) or None in some error cases
|
||||
|
Reference in New Issue
Block a user