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, extra = None):
59 faultString = "Not fully implemented"
60 SfaFault.__init__(self, 109, faultString, extra)
62 class SfaAPIError(SfaFault):
63 def __init__(self, extra = None):
64 faultString = "Internal API error"
65 SfaFault.__init__(self, 111, faultString, extra)
67 class MalformedHrnException(SfaFault):
68 def __init__(self, value, extra = None):
70 faultString = "Malformed HRN: %(value)s" % locals()
71 SfaFault.__init__(self, 102, faultString, extra)
73 return repr(self.value)
75 class TreeException(SfaFault):
76 def __init__(self, value, extra = None):
78 faultString = "Tree Exception: %(value)s, " % locals()
79 SfaFault.__init__(self, 111, faultString, extra)
81 return repr(self.value)
83 class NonExistingRecord(SfaFault):
84 def __init__(self, value, extra = None):
86 faultString = "Non exsiting record %(value)s, " % locals()
87 SfaFault.__init__(self, 111, faultString, extra)
89 return repr(self.value)
91 class ExistingRecord(SfaFault):
92 def __init__(self, value, extra = None):
94 faultString = "Existing record: %(value)s, " % locals()
95 SfaFault.__init__(self, 111, faultString, extra)
97 return repr(self.value)
100 class NonexistingCredType(SfaFault):
101 def __init__(self, value, extra = None):
103 faultString = "Non existing record: %(value)s, " % locals()
104 SfaFault.__init__(self, 111, faultString, extra)
106 return repr(self.value)
108 class NonexistingFile(SfaFault):
109 def __init__(self, value, extra = None):
111 faultString = "Non existing file: %(value)s, " % locals()
112 SfaFault.__init__(self, 111, faultString, extra)
114 return repr(self.value)
116 class InvalidRPCParams(SfaFault):
117 def __init__(self, value, extra = None):
119 faultString = "Invalid RPC Params: %(value)s, " % locals()
120 SfaFault.__init__(self, 102, faultString, extra)
122 return repr(self.value)
124 # SMBAKER exceptions follow
126 class ConnectionKeyGIDMismatch(SfaFault):
127 def __init__(self, value, extra = None):
129 faultString = "Connection Key GID mismatch: %(value)s" % locals()
130 SfaFault.__init__(self, 102, faultString, extra)
132 return repr(self.value)
134 class MissingCallerGID(SfaFault):
135 def __init__(self, value, extra = None):
137 faultString = "Missing Caller GID: %(value)s" % locals()
138 SfaFault.__init__(self, 102, faultString, extra)
140 return repr(self.value)
142 class RecordNotFound(SfaFault):
143 def __init__(self, value, extra = None):
145 faultString = "Record not found: %(value)s" % locals()
146 SfaFault.__init__(self, 102, faultString, extra)
148 return repr(self.value)
150 class UnknownSfaType(SfaFault):
151 def __init__(self, value, extra = None):
153 faultString = "Unknown SFA Type: %(value)s" % locals()
154 SfaFault.__init__(self, 102, faultString, extra)
156 return repr(self.value)
158 class MissingAuthority(SfaFault):
159 def __init__(self, value, extra = None):
161 faultString = "Missing authority: %(value)s" % locals()
162 SfaFault.__init__(self, 102, faultString, extra)
164 return repr(self.value)
166 class PlanetLabRecordDoesNotExist(SfaFault):
167 def __init__(self, value, extra = None):
169 faultString = "PlanetLab record does not exist : %(value)s" % locals()
170 SfaFault.__init__(self, 102, faultString, extra)
172 return repr(self.value)
174 class PermissionError(SfaFault):
175 def __init__(self, value, extra = None):
177 faultString = "Permission error: %(value)s" % locals()
178 SfaFault.__init__(self, 108, faultString, extra)
180 return repr(self.value)
182 class InsufficientRights(SfaFault):
183 def __init__(self, value, extra = None):
185 faultString = "Insufficient rights: %(value)s" % locals()
186 SfaFault.__init__(self, 108, faultString, extra)
188 return repr(self.value)
190 class MissingDelegateBit(SfaFault):
191 def __init__(self, value, extra = None):
193 faultString = "Missing delegate bit: %(value)s" % locals()
194 SfaFault.__init__(self, 108, faultString, extra)
196 return repr(self.value)
198 class ChildRightsNotSubsetOfParent(SfaFault):
199 def __init__(self, value, extra = None):
201 faultString = "Child rights not subset of parent: %(value)s" % locals()
202 SfaFault.__init__(self, 103, faultString, extra)
204 return repr(self.value)
206 class CertMissingParent(SfaFault):
207 def __init__(self, value, extra = None):
209 faultString = "Cert missing parent: %(value)s" % locals()
210 SfaFault.__init__(self, 103, faultString, extra)
212 return repr(self.value)
214 class CertNotSignedByParent(SfaFault):
215 def __init__(self, value, extra = None):
217 faultString = "Cert not signed by parent: %(value)s" % locals()
218 SfaFault.__init__(self, 103, faultString, extra)
220 return repr(self.value)
222 class GidParentHrn(SfaFault):
223 def __init__(self, value, extra = None):
225 faultString = "Cert URN is not an extension of its parent: %(value)s" % locals()
226 SfaFault.__init__(self, 103, faultString, extra)
228 return repr(self.value)
230 class GidInvalidParentHrn(SfaFault):
231 def __init__(self, value, extra = None):
233 faultString = "GID invalid parent hrn: %(value)s" % locals()
234 SfaFault.__init__(self, 102, faultString, extra)
236 return repr(self.value)
238 class SliverDoesNotExist(SfaFault):
239 def __init__(self, value, extra = None):
241 faultString = "Sliver does not exist : %(value)s" % locals()
242 SfaFault.__init__(self, 102, faultString, extra)
244 return repr(self.value)
246 class BadRequestHash(xmlrpclib.Fault):
247 def __init__(self, hash = None, extra = None):
248 faultString = "bad request hash: " + str(hash)
249 xmlrpclib.Fault.__init__(self, 902, faultString)
251 class MissingTrustedRoots(SfaFault):
252 def __init__(self, value, extra = None):
254 faultString = "Trusted root directory does not exist: %(value)s" % locals()
255 SfaFault.__init__(self, 102, faultString, extra)
257 return repr(self.value)
259 class MissingSfaInfo(SfaFault):
260 def __init__(self, value, extra = None):
262 faultString = "Missing information: %(value)s" % locals()
263 SfaFault.__init__(self, 102, faultString, extra)
265 return repr(self.value)
267 class InvalidRSpec(SfaFault):
268 def __init__(self, value, extra = None):
270 faultString = "Invalid RSpec: %(value)s" % locals()
271 SfaFault.__init__(self, 108, faultString, extra)
273 return repr(self.value)
275 class AccountNotEnabled(SfaFault):
276 def __init__(self, extra = None):
277 faultString = "Account Disabled"
278 SfaFault.__init__(self, 108, faultString, extra)
280 return repr(self.value)
282 class CredentialNotVerifiable(SfaFault):
283 def __init__(self, value, extra = None):
285 faultString = "Unable to verify credential: %(value)s, " %locals()
286 SfaFault.__init__(self, 115, faultString, extra)
288 return repr(self.value)