Cleanup exceptions

There are some invalid usages about exceptions. They put some invalid
error messages to the log like this.
  --------------------------
  BuildErrorException: Server %(server_id)s failed to build and is in
  ERROR status)
  --------------------------
This commit fixes them.

NOTE: 'RateLimitExceeded' is only used in tempest/common/rest_client.py.
 This was refactored in I6c38c343618f92e0e79843aaa662a3d24026702b . But
 the class was not. And the last usage of 'SQLException' was removed in
 I0fac7b030c51985f9d6d93129bf9bab75c18cd11 . But the class was not.

Change-Id: I1477e093a56210c0c9a65fa32900c2c0b876d9a4
This commit is contained in:
Masayuki Igawa 2014-01-27 15:25:06 +09:00
parent 93daa28712
commit a0e786af52
4 changed files with 8 additions and 10 deletions

View File

@ -274,13 +274,15 @@ class RestClient(object):
elif resp.status == 401:
raise exceptions.AuthenticationFailure(user=user,
password=password)
password=password,
tenant=project_name)
else:
self.LOG.error("Failed to obtain token using V3 authentication"
" (auth URL is '%s'), the response status is %s" %
(req_url, resp.status))
raise exceptions.AuthenticationFailure(user=user,
password=password)
password=password,
tenant=project_name)
def expected_success(self, expected_code, read_code):
assert_msg = ("This function only allowed to use for HTTP status"

View File

@ -123,8 +123,7 @@ class EndpointNotFound(TempestException):
class RateLimitExceeded(TempestException):
message = ("Rate limit exceeded.\nMessage: %(message)s\n"
"Details: %(details)s")
message = "Rate limit exceeded"
class OverLimit(TempestException):
@ -162,10 +161,6 @@ class ServerUnreachable(TempestException):
message = "The server is not reachable via the configured network"
class SQLException(TempestException):
message = "SQL error: %(message)s"
class TearDownException(TempestException):
message = "%(num)d cleanUp operation failed"

View File

@ -394,7 +394,8 @@ class OfficialClientTest(tempest.test.BaseTestCase):
if new_status.lower() == error_status.lower():
message = ("%s failed to get to expected status. "
"In %s state.") % (thing, new_status)
raise exceptions.BuildErrorException(message)
raise exceptions.BuildErrorException(message,
server_id=thing_id)
elif new_status == expected_status and expected_status is not None:
return True # All good.
LOG.debug("Waiting for %s to get to %s status. "

View File

@ -379,7 +379,7 @@ class ServersClientXML(RestClientXML):
server_status = body['status']
if server_status == 'ERROR' and not ignore_error:
raise exceptions.BuildErrorException
raise exceptions.BuildErrorException(server_id=server_id)
if int(time.time()) - start_time >= self.build_timeout:
raise exceptions.TimeoutException