Commit e6345c35 authored by Iustin Pop's avatar Iustin Pop
Browse files

Encode the actual exception raised by LU execution



Currently, the actual exception raised during an LU execution (one of
OpPrereqError, OpExecError, HooksError, etc.) is lost because the
jqueue.py code simply sets that to a str(err), and the code in cli.py
simply passes that string to OpExecError.

This patch moves to encoding the errors as per errors.EncodeError and
changes the cli code to parse and raise that (if possible).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
(cherry picked from commit bcb66fca)
parent a6607331
......@@ -572,6 +572,7 @@ def PollJob(job_id, cl=None, feedback_fn=None):
if status == constants.OP_STATUS_SUCCESS:
has_ok = True
elif status == constants.OP_STATUS_ERROR:
errors.MaybeRaise(msg)
if has_ok:
raise errors.OpExecError("partial failure (opcode %d): %s" %
(idx, msg))
......
......@@ -460,7 +460,10 @@ class _JobQueueWorker(workerpool.BaseWorker):
try:
try:
op.status = constants.OP_STATUS_ERROR
op.result = str(err)
if isinstance(err, errors.GenericError):
op.result = errors.EncodeException(err)
else:
op.result = str(err)
op.end_timestamp = TimeStampNow()
logging.info("Op %s/%s: Error in opcode %s: %s",
idx + 1, count, op_summary, err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment