blob: 016de69ad430def7ddcb69550443fd15748e9e09 [file] [log] [blame]
Attila Fazekasa23f5002012-10-23 19:32:45 +02001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2012 OpenStack, LLC
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18
Jay Pipes5135bfc2012-01-05 15:46:49 -050019class TempestException(Exception):
20 """
21 Base Tempest Exception
22
23 To correctly use this class, inherit from it and define
24 a 'message' property. That message will get printf'd
25 with the keyword arguments provided to the constructor.
26 """
27 message = "An unknown exception occurred"
28
29 def __init__(self, *args, **kwargs):
30 try:
31 self._error_string = self.message % kwargs
32 except Exception:
33 # at least get the core message out if something happened
34 self._error_string = self.message
35 if len(args) > 0:
36 # If there is a non-kwarg parameter, assume it's the error
37 # message or reason description and tack it on to the end
38 # of the exception message
39 # Convert all arguments into their string representations...
40 args = ["%s" % arg for arg in args]
41 self._error_string = (self._error_string +
42 "\nDetails: %s" % '\n'.join(args))
Daryl Walleckf0087032011-12-18 13:37:05 -060043
44 def __str__(self):
Jay Pipes5135bfc2012-01-05 15:46:49 -050045 return self._error_string
Daryl Walleck1465d612011-11-02 02:22:15 -050046
47
Daryl Walleck587385b2012-03-03 13:00:26 -060048class InvalidConfiguration(TempestException):
49 message = "Invalid Configuration"
50
51
Jay Pipes5135bfc2012-01-05 15:46:49 -050052class NotFound(TempestException):
53 message = "Object not found"
Daryl Walleckadea1fa2011-11-15 18:36:39 -060054
55
Daryl Walleckced8eb82012-03-19 13:52:37 -050056class Unauthorized(TempestException):
57 message = 'Unauthorized'
58
59
Jay Pipes5135bfc2012-01-05 15:46:49 -050060class TimeoutException(TempestException):
61 message = "Request timed out"
Brian Lamar12d9b292011-12-08 12:41:21 -050062
63
Jay Pipes5135bfc2012-01-05 15:46:49 -050064class BuildErrorException(TempestException):
65 message = "Server %(server_id)s failed to build and is in ERROR status"
Daryl Wallecked8bef32011-12-05 23:02:08 -060066
67
Katherine Elliott74f68512012-05-18 10:19:22 -060068class AddImageException(TempestException):
69 message = "Image %(image_id) failed to become ACTIVE in the allotted time"
70
71
Attila Fazekasa23f5002012-10-23 19:32:45 +020072class EC2RegisterImageException(TempestException):
73 message = ("Image %(image_id) failed to become 'available' "
74 "in the allotted time")
75
76
rajalakshmi-ganesane3bb58f2012-05-16 12:01:15 +053077class VolumeBuildErrorException(TempestException):
78 message = "Volume %(volume_id)s failed to build and is in ERROR status"
79
80
Jay Pipes5135bfc2012-01-05 15:46:49 -050081class BadRequest(TempestException):
82 message = "Bad request"
Adam Gandelmane2d46b42012-01-03 17:40:44 -080083
84
Jay Pipes5135bfc2012-01-05 15:46:49 -050085class AuthenticationFailure(TempestException):
86 message = ("Authentication with user %(user)s and password "
87 "%(password)s failed")
Brian Waldon738cd632011-12-12 18:45:09 -050088
89
Jay Pipes5135bfc2012-01-05 15:46:49 -050090class EndpointNotFound(TempestException):
91 message = "Endpoint not found"
Brian Waldon738cd632011-12-12 18:45:09 -050092
Jay Pipes5135bfc2012-01-05 15:46:49 -050093
Jay Pipes9b043842012-01-23 23:34:26 -050094class RateLimitExceeded(TempestException):
95 message = ("Rate limit exceeded.\nMessage: %(message)s\n"
96 "Details: %(details)s")
97
98
Jay Pipes5135bfc2012-01-05 15:46:49 -050099class OverLimit(TempestException):
100 message = "Quota exceeded"
101
102
103class ComputeFault(TempestException):
104 message = "Got compute fault"
105
106
Jay Pipesedba0622012-07-08 21:34:36 -0400107class IdentityError(TempestException):
108 message = "Got identity error"
109
110
Jay Pipes5135bfc2012-01-05 15:46:49 -0500111class Duplicate(TempestException):
112 message = "An object with that identifier already exists"
Daryl Walleck6b9b2882012-04-08 21:43:39 -0500113
114
115class SSHTimeout(TempestException):
116 message = ("Connection to the %(host)s via SSH timed out.\n"
Jaroslav Hennerab327842012-09-11 15:44:29 +0200117 "User: %(user)s, Password: %(password)s")
118
119
120class SSHExecCommandFailed(TempestException):
121 ''' Raised when remotely executed command returns nonzero status. '''
122 message = ("Command '%(command)s', exit status: %(exit_status)d, "
123 "Error:\n%(strerror)s")
Daryl Walleck6b9b2882012-04-08 21:43:39 -0500124
125
126class ServerUnreachable(TempestException):
127 message = "The server is not reachable via the configured network"
Jay Pipes051075a2012-04-28 17:39:37 -0400128
129
130class SQLException(TempestException):
131 message = "SQL error: %(message)s"
Attila Fazekasa23f5002012-10-23 19:32:45 +0200132
133
134class TearDownException(TempestException):
135 message = "%(num)d cleanUp operation failed"