2 # GeniAPI XML-RPC faults
11 class GeniFault(xmlrpclib.Fault):
12 def __init__(self, faultCode, faultString, extra = None):
14 faultString += ": " + extra
15 xmlrpclib.Fault.__init__(self, faultCode, faultString)
17 class GeniInvalidAPIMethod(GeniFault):
18 def __init__(self, method, interface = None, extra = None):
19 faultString = "Invalid method " + method
21 faultString += " for interface " + interface
22 GeniFault.__init__(self, 100, faultString, extra)
24 class GeniInvalidArgumentCount(GeniFault):
25 def __init__(self, got, min, max = min, extra = None):
27 expected = "%d-%d" % (min, max)
30 faultString = "Expected %s arguments, got %d" % \
32 GeniFault.__init__(self, 101, faultString, extra)
34 class GeniInvalidArgument(GeniFault):
35 def __init__(self, extra = None, name = None):
37 faultString = "Invalid %s value" % name
39 faultString = "Invalid argument"
40 GeniFault.__init__(self, 102, faultString, extra)
42 class GeniAuthenticationFailure(GeniFault):
43 def __init__(self, extra = None):
44 faultString = "Failed to authenticate call"
45 GeniFault.__init__(self, 103, faultString, extra)
47 class GeniDBError(GeniFault):
48 def __init__(self, extra = None):
49 faultString = "Database error"
50 GeniFault.__init__(self, 106, faultString, extra)
52 class GeniPermissionDenied(GeniFault):
53 def __init__(self, extra = None):
54 faultString = "Permission denied"
55 GeniFault.__init__(self, 108, faultString, extra)
57 class GeniNotImplemented(GeniFault):
58 def __init__(self, extra = None):
59 faultString = "Not fully implemented"
60 GeniFault.__init__(self, 109, faultString, extra)
62 class GeniAPIError(GeniFault):
63 def __init__(self, extra = None):
64 faultString = "Internal API error"
65 GeniFault.__init__(self, 111, faultString, extra)
67 class MalformedHrnException(GeniFault):
68 def __init__(self, value, extra = None):
70 faultString = "Malformed HRN: %(value)s" % locals()
71 GeniFault.__init__(self, 102, faultString, extra)
73 return repr(self.value)
75 class TreeException(GeniFault):
76 def __init__(self, value, extra = None):
78 faultString = "Tree Exception: %(value)s, " % locals()
79 GeniFault.__init__(self, 111, faultString, extra)
81 return repr(self.value)
83 class NonexistingRecord(GeniFault):
84 def __init__(self, value, extra = None):
86 faultString = "Non exsiting record %(value)s, " % locals()
87 GeniFault.__init__(self, 111, faultString, extra)
89 return repr(self.value)
91 class ExistingRecord(GeniFault):
92 def __init__(self, value, extra = None):
94 faultString = "Existing record: %(value)s, " % locals()
95 GeniFault.__init__(self, 111, faultString, extra)
97 return repr(self.value)
99 class NonexistingCredType(GeniFault):
100 def __init__(self, value, extra = None):
102 faultString = "Non existing record: %(value)s, " % locals()
103 GeniFault.__init__(self, 111, faultString, extra)
105 return repr(self.value)
107 class NonexistingFile(GeniFault):
108 def __init__(self, value):
110 faultString = "Non existing file: %(value)s, " % locals()
111 GeniFault.__init__(self, 111, faultString, extra)
113 return repr(self.value)
115 class InvalidRPCParams(GeniFault):
116 def __init__(self, value):
118 faultString = "Invalid RPC Params: %(value)s, " % locals()
119 GeniFault.__init__(self, 102, faultString, extra)
121 return repr(self.value)
123 # SMBAKER exceptions follow
125 class ConnectionKeyGIDMismatch(GeniFault):
126 def __init__(self, value, extra = None):
128 faultString = "Connection Key GID mismatch: %(value)s" % locals()
129 GeniFault.__init__(self, 102, faultString, extra)
131 return repr(self.value)
133 class MissingCallerGID(GeniFault):
134 def __init__(self, value, extra = None):
136 faultString = "Missing Caller GID: %(value)s" % locals()
137 GeniFault.__init__(self, 102, faultString, extra)
139 return repr(self.value)
141 class RecordNotFound(GeniFault):
142 def __init__(self, value, extra = None):
144 faultString = "Record not found: %(value)s" % locals()
145 GeniFault.__init__(self, 102, faultString, extra)
147 # return repr(self.value)
149 class UnknownGeniType(GeniFault):
150 def __init__(self, value, extra = None):
152 faultString = "Unknown Geni Type: %(value)s" % locals()
153 GeniFault.__init__(self, 102, faultString, extra)
155 return repr(self.value)
157 class MissingAuthority(GeniFault):
158 def __init__(self, value, extra = None):
160 faultString = "Missing authority: %(value)s" % locals()
161 GeniFault.__init__(self, 102, faultString, extra)
163 return repr(self.value)
165 class PlanetLabRecordDoesNotExist(GeniFault):
166 def __init__(self, value, extra = None):
168 faultString = "PlanetLab record does not exist : %(value)s" % locals()
169 GeniFault.__init__(self, 102, faultString, extra)
171 return repr(self.value)
173 class PermissionError(GeniFault):
174 def __init__(self, value, extra = None):
176 faultString = "Permission error: %(value)s" % locals()
177 GeniFault.__init__(self, 108, faultString, extra)
179 return repr(self.value)
181 class InsufficientRights(GeniFault):
182 def __init__(self, value, extra = None):
184 faultString = "Insufficient rights: %(value)s" % locals()
185 GeniFault.__init__(self, 108, faultString, extra)
187 return repr(self.value)
189 class MissingDelegateBit(GeniFault):
190 def __init__(self, value, extra = None):
192 faultString = "Missing delegate bit: %(value)s" % locals()
193 GeniFault.__init__(self, 108, faultString, extra)
195 return repr(self.value)
197 class ChildRightsNotSubsetOfParent(GeniFault):
198 def __init__(self, value, extra = None):
200 faultString = "Child rights not subset of parent: %(value)s" % locals()
201 GeniFault.__init__(self, 103, faultString, extra)
203 return repr(self.value)
205 class CertMissingParent(GeniFault):
206 def __init__(self, value, extra = None):
208 faultString = "Cert missing parent: %(value)s" % locals()
209 GeniFault.__init__(self, 103, faultString, extra)
211 return repr(self.value)
213 class CertNotSignedByParent(GeniFault):
214 def __init__(self, value, extra = None):
216 faultString = "Cert not signed by parent: %(value)s" % locals()
217 GeniFault.__init__(self, 103, faultString, extra)
219 return repr(self.value)
221 class GidInvalidParentHrn(GeniFault):
222 def __init__(self, value, extra = None):
224 faultString = "GID invalid parent hrn: %(value)s" % locals()
225 GeniFault.__init__(self, 102, faultString, extra)
227 return repr(self.value)
229 class SliverDoesNotExist(GeniFault):
230 def __init__(self, value, extra = None):
232 faultString = "Sliver does not exist : %(value)s" % locals()
233 GeniFault.__init__(self, 102, faultString, extra)
235 return repr(self.value)