Commit bcb66fca 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>
parent 6956e9cd
...@@ -716,6 +716,7 @@ def PollJob(job_id, cl=None, feedback_fn=None): ...@@ -716,6 +716,7 @@ def PollJob(job_id, cl=None, feedback_fn=None):
if status == constants.OP_STATUS_SUCCESS: if status == constants.OP_STATUS_SUCCESS:
has_ok = True has_ok = True
elif status == constants.OP_STATUS_ERROR: elif status == constants.OP_STATUS_ERROR:
errors.MaybeRaise(msg)
if has_ok: if has_ok:
raise errors.OpExecError("partial failure (opcode %d): %s" % raise errors.OpExecError("partial failure (opcode %d): %s" %
(idx, msg)) (idx, msg))
......
...@@ -460,7 +460,10 @@ class _JobQueueWorker(workerpool.BaseWorker): ...@@ -460,7 +460,10 @@ class _JobQueueWorker(workerpool.BaseWorker):
try: try:
try: try:
op.status = constants.OP_STATUS_ERROR 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() op.end_timestamp = TimeStampNow()
logging.info("Op %s/%s: Error in opcode %s: %s", logging.info("Op %s/%s: Error in opcode %s: %s",
idx + 1, count, op_summary, err) 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