11 class SfaFault(xmlrpclib.Fault):
12 def __init__(self, faultCode, faultString, extra = None):
14 faultString += ": " + str(extra)
15 xmlrpclib.Fault.__init__(self, faultCode, faultString)
17 class SfaInvalidAPIMethod(SfaFault):
18 def __init__(self, method, interface = None, extra = None):
19 faultString = "Invalid method " + method
21 faultString += " for interface " + interface
22 SfaFault.__init__(self, 100, faultString, extra)
24 class SfaInvalidArgumentCount(SfaFault):
25 def __init__(self, got, min, max = min, extra = None):
27 expected = "%d-%d" % (min, max)
30 faultString = "Expected %s arguments, got %d" % \
32 SfaFault.__init__(self, 101, faultString, extra)
34 class SfaInvalidArgument(SfaFault):
35 def __init__(self, extra = None, name = None):
37 faultString = "Invalid %s value" % name
39 faultString = "Invalid argument"
40 SfaFault.__init__(self, 102, faultString, extra)
42 class SfaAuthenticationFailure(SfaFault):
43 def __init__(self, extra = None):
44 faultString = "Failed to authenticate call"
45 SfaFault.__init__(self, 103, faultString, extra)
47 class SfaDBError(SfaFault):
48 def __init__(self, extra = None):
49 faultString = "Database error"
50 SfaFault.__init__(self, 106, faultString, extra)
52 class SfaPermissionDenied(SfaFault):
53 def __init__(self, extra = None):
54 faultString = "Permission denied"
55 SfaFault.__init__(self, 108, faultString, extra)
57 class SfaNotImplemented(SfaFault):
58 def __init__(self, interface=None, extra = None):
59 faultString = "Not implemented"
61 faultString += " at interface " + interface
62 SfaFault.__init__(self, 109, faultString, extra)
64 class SfaAPIError(SfaFault):
65 def __init__(self, extra = None):
66 faultString = "Internal API error"
67 SfaFault.__init__(self, 111, faultString, extra)
69 class MalformedHrnException(SfaFault):
70 def __init__(self, value, extra = None):
72 faultString = "Malformed HRN: %(value)s" % locals()
73 SfaFault.__init__(self, 102, faultString, extra)
75 return repr(self.value)
77 class TreeException(SfaFault):
78 def __init__(self, value, extra = None):
80 faultString = "Tree Exception: %(value)s, " % locals()
81 SfaFault.__init__(self, 111, faultString, extra)
83 return repr(self.value)
85 class NonExistingRecord(SfaFault):
86 def __init__(self, value, extra = None):
88 faultString = "Non exsiting record %(value)s, " % locals()
89 SfaFault.__init__(self, 111, faultString, extra)
91 return repr(self.value)
93 class ExistingRecord(SfaFault):
94 def __init__(self, value, extra = None):
96 faultString = "Existing record: %(value)s, " % locals()
97 SfaFault.__init__(self, 111, faultString, extra)
99 return repr(self.value)
102 class NonexistingCredType(SfaFault):
103 def __init__(self, value, extra = None):
105 faultString = "Non existing record: %(value)s, " % locals()
106 SfaFault.__init__(self, 111, faultString, extra)
108 return repr(self.value)
110 class NonexistingFile(SfaFault):
111 def __init__(self, value, extra = None):
113 faultString = "Non existing file: %(value)s, " % locals()
114 SfaFault.__init__(self, 111, faultString, extra)
116 return repr(self.value)
118 class InvalidRPCParams(SfaFault):
119 def __init__(self, value, extra = None):
121 faultString = "Invalid RPC Params: %(value)s, " % locals()
122 SfaFault.__init__(self, 102, faultString, extra)
124 return repr(self.value)
126 # SMBAKER exceptions follow
128 class ConnectionKeyGIDMismatch(SfaFault):
129 def __init__(self, value, extra = None):
131 faultString = "Connection Key GID mismatch: %(value)s" % locals()
132 SfaFault.__init__(self, 102, faultString, extra)
134 return repr(self.value)
136 class MissingCallerGID(SfaFault):
137 def __init__(self, value, extra = None):
139 faultString = "Missing Caller GID: %(value)s" % locals()
140 SfaFault.__init__(self, 102, faultString, extra)
142 return repr(self.value)
144 class RecordNotFound(SfaFault):
145 def __init__(self, value, extra = None):
147 faultString = "Record not found: %(value)s" % locals()
148 SfaFault.__init__(self, 102, faultString, extra)
150 return repr(self.value)
152 class UnknownSfaType(SfaFault):
153 def __init__(self, value, extra = None):
155 faultString = "Unknown SFA Type: %(value)s" % locals()
156 SfaFault.__init__(self, 102, faultString, extra)
158 return repr(self.value)
160 class MissingAuthority(SfaFault):
161 def __init__(self, value, extra = None):
163 faultString = "Missing authority: %(value)s" % locals()
164 SfaFault.__init__(self, 102, faultString, extra)
166 return repr(self.value)
168 class PlanetLabRecordDoesNotExist(SfaFault):
169 def __init__(self, value, extra = None):
171 faultString = "PlanetLab record does not exist : %(value)s" % locals()
172 SfaFault.__init__(self, 102, faultString, extra)
174 return repr(self.value)
176 class PermissionError(SfaFault):
177 def __init__(self, value, extra = None):
179 faultString = "Permission error: %(value)s" % locals()
180 SfaFault.__init__(self, 108, faultString, extra)
182 return repr(self.value)
184 class InsufficientRights(SfaFault):
185 def __init__(self, value, extra = None):
187 faultString = "Insufficient rights: %(value)s" % locals()
188 SfaFault.__init__(self, 108, faultString, extra)
190 return repr(self.value)
192 class MissingDelegateBit(SfaFault):
193 def __init__(self, value, extra = None):
195 faultString = "Missing delegate bit: %(value)s" % locals()
196 SfaFault.__init__(self, 108, faultString, extra)
198 return repr(self.value)
200 class ChildRightsNotSubsetOfParent(SfaFault):
201 def __init__(self, value, extra = None):
203 faultString = "Child rights not subset of parent: %(value)s" % locals()
204 SfaFault.__init__(self, 103, faultString, extra)
206 return repr(self.value)
208 class CertMissingParent(SfaFault):
209 def __init__(self, value, extra = None):
211 faultString = "Cert missing parent: %(value)s" % locals()
212 SfaFault.__init__(self, 103, faultString, extra)
214 return repr(self.value)
216 class CertNotSignedByParent(SfaFault):
217 def __init__(self, value, extra = None):
219 faultString = "Cert not signed by parent: %(value)s" % locals()
220 SfaFault.__init__(self, 103, faultString, extra)
222 return repr(self.value)
224 class GidParentHrn(SfaFault):
225 def __init__(self, value, extra = None):
227 faultString = "Cert URN is not an extension of its parent: %(value)s" % locals()
228 SfaFault.__init__(self, 103, faultString, extra)
230 return repr(self.value)
232 class GidInvalidParentHrn(SfaFault):
233 def __init__(self, value, extra = None):
235 faultString = "GID invalid parent hrn: %(value)s" % locals()
236 SfaFault.__init__(self, 102, faultString, extra)
238 return repr(self.value)
240 class SliverDoesNotExist(SfaFault):
241 def __init__(self, value, extra = None):
243 faultString = "Sliver does not exist : %(value)s" % locals()
244 SfaFault.__init__(self, 102, faultString, extra)
246 return repr(self.value)
248 class BadRequestHash(xmlrpclib.Fault):
249 def __init__(self, hash = None, extra = None):
250 faultString = "bad request hash: " + str(hash)
251 xmlrpclib.Fault.__init__(self, 902, faultString)
253 class MissingTrustedRoots(SfaFault):
254 def __init__(self, value, extra = None):
256 faultString = "Trusted root directory does not exist: %(value)s" % locals()
257 SfaFault.__init__(self, 102, faultString, extra)
259 return repr(self.value)
261 class MissingSfaInfo(SfaFault):
262 def __init__(self, value, extra = None):
264 faultString = "Missing information: %(value)s" % locals()
265 SfaFault.__init__(self, 102, faultString, extra)
267 return repr(self.value)
269 class InvalidRSpec(SfaFault):
270 def __init__(self, value, extra = None):
272 faultString = "Invalid RSpec: %(value)s" % locals()
273 SfaFault.__init__(self, 108, faultString, extra)
275 return repr(self.value)
277 class AccountNotEnabled(SfaFault):
278 def __init__(self, extra = None):
279 faultString = "Account Disabled"
280 SfaFault.__init__(self, 108, faultString, extra)
282 return repr(self.value)
284 class CredentialNotVerifiable(SfaFault):
285 def __init__(self, value, extra = None):
287 faultString = "Unable to verify credential: %(value)s, " %locals()
288 SfaFault.__init__(self, 115, faultString, extra)
290 return repr(self.value)
292 class CertExpired(SfaFault):
293 def __init__(self, value, extra=None):
295 faultString = "%s cert is expired" % value
296 SfaFault.__init__(self, 102, faultString, extra)