Merge "Wrap eventlet's Timeout exception"

This commit is contained in:
Jenkins
2014-07-21 06:57:24 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 1 deletions

View File

@@ -223,3 +223,11 @@ class EDPError(SaharaException):
def __init__(self, message):
self.message = message
class TimeoutException(SaharaException):
code = "TIMEOUT"
message = "Operation timed out after %i second(s)"
def __init__(self, timeout):
self.message = self.message % timeout

View File

@@ -330,7 +330,7 @@ class InstanceInteropHelper(remote.Remote):
def _run_with_log(self, func, timeout, *args, **kwargs):
start_time = time.time()
try:
with e_timeout.Timeout(timeout):
with e_timeout.Timeout(timeout, ex.TimeoutException(timeout)):
return self._run(func, *args, **kwargs)
finally:
self._log_command('%s took %.1f seconds to complete' % (