Let the shell component write out stderr and stdout if names are given
This commit is contained in:
@@ -14,7 +14,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
|
||||||
import re
|
import re
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
@@ -323,18 +322,14 @@ class PythonInstallComponent(PkgInstallComponent):
|
|||||||
for (name, working_dir) in real_dirs.items():
|
for (name, working_dir) in real_dirs.items():
|
||||||
self.tracewriter.dirs_made(*sh.mkdirslist(working_dir))
|
self.tracewriter.dirs_made(*sh.mkdirslist(working_dir))
|
||||||
self.tracewriter.py_installed(name, working_dir)
|
self.tracewriter.py_installed(name, working_dir)
|
||||||
(stdout, stderr) = sh.execute(*setup_cmd,
|
root_fn = sh.joinpths(self.get_option('trace_dir'), "%s.python.setup" % (name))
|
||||||
|
sh.execute(*setup_cmd,
|
||||||
cwd=working_dir,
|
cwd=working_dir,
|
||||||
run_as_root=True)
|
run_as_root=True,
|
||||||
py_trace_name = "%s.%s" % (name, 'python')
|
stderr_fn='%s.stderr' % (root_fn),
|
||||||
py_writer = tr.TraceWriter(tr.trace_fn(self.get_option('trace_dir'),
|
stdout_fn='%s.stdout' % (root_fn),
|
||||||
py_trace_name), break_if_there=False)
|
trace_writer=self.tracewriter
|
||||||
# Format or json encoding isn't really needed here since this is
|
)
|
||||||
# more just for information output/lookup if desired.
|
|
||||||
py_writer.trace("CMD", " ".join(setup_cmd))
|
|
||||||
py_writer.trace("STDOUT", stdout)
|
|
||||||
py_writer.trace("STDERR", stderr)
|
|
||||||
self.tracewriter.file_touched(py_writer.filename())
|
|
||||||
|
|
||||||
def _python_install(self):
|
def _python_install(self):
|
||||||
self._install_pips()
|
self._install_pips()
|
||||||
|
|||||||
@@ -208,16 +208,28 @@ def execute(*cmd, **kwargs):
|
|||||||
stderr = ''
|
stderr = ''
|
||||||
|
|
||||||
if (not ignore_exit_code) and (rc not in check_exit_code):
|
if (not ignore_exit_code) and (rc not in check_exit_code):
|
||||||
raise excp.ProcessExecutionError(exit_code=rc, stdout=stdout, \
|
raise excp.ProcessExecutionError(exit_code=rc, stdout=stdout,
|
||||||
stderr=stderr, cmd=str_cmd)
|
stderr=stderr, cmd=str_cmd)
|
||||||
else:
|
else:
|
||||||
# Log it anyway
|
# Log it anyway
|
||||||
if rc not in check_exit_code:
|
if rc not in check_exit_code:
|
||||||
LOG.debug("A failure may of just happened when running command %r [%s] (%s, %s)", \
|
LOG.debug("A failure may of just happened when running command %r [%s] (%s, %s)",
|
||||||
str_cmd, rc, stdout.strip(), stderr.strip())
|
str_cmd, rc, stdout, stderr)
|
||||||
# Log for debugging figuring stuff out
|
# Log for debugging figuring stuff out
|
||||||
LOG.debug("Received stdout: %s" % (stdout.strip()))
|
LOG.debug("Received stdout: %s" % (stdout))
|
||||||
LOG.debug("Received stderr: %s" % (stderr.strip()))
|
LOG.debug("Received stderr: %s" % (stderr))
|
||||||
|
# See if a requested storage place was given for stderr/stdout
|
||||||
|
trace_writer = kwargs.get('trace_writer')
|
||||||
|
stdout_fn = kwargs.get('stdout_fn')
|
||||||
|
if stdout_fn:
|
||||||
|
write_file(stdout_fn, stdout)
|
||||||
|
if trace_writer:
|
||||||
|
trace_writer.file_touched(stdout_fn)
|
||||||
|
stderr_fn = kwargs.get('stderr_fn')
|
||||||
|
if stderr_fn:
|
||||||
|
write_file(stderr_fn, stderr)
|
||||||
|
if trace_writer:
|
||||||
|
trace_writer.file_touched(stderr_fn)
|
||||||
return (stdout, stderr)
|
return (stdout, stderr)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user