Keep the trace when reraising docker error

In before, we catch all exceptions raised by docker-py and reraise
a Zun exception. The original trace is lost in this approach which
makes it hard to debug. This commit reraise the docker error by
keeping its trace.

Change-Id: Ie680cc2e4fe3c56d58ee729bdf191f2efa0aec98
This commit is contained in:
Hongbin Lu 2017-08-28 19:03:47 +00:00 committed by Madhuri Kumari
parent 494d9545ff
commit ee968441aa
1 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@
import contextlib
import re
import six
import sys
import tarfile
import docker
@ -40,7 +41,8 @@ def docker_client():
**client_kwargs
)
except errors.APIError as e:
raise exception.DockerError(error_msg=six.text_type(e))
desired_exc = exception.DockerError(error_msg=six.text_type(e))
six.reraise(type(desired_exc), desired_exc, sys.exc_info()[2])
class DockerHTTPClient(docker.APIClient):