# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Work.
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Work.
#
-# THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS
+# THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS
-class SfaFault(xmlrpclib.Fault):
- def __init__(self, faultCode, faultString, extra = None):
+
+class SfaFault(xmlrpc_client.Fault):
+
+ def __init__(self, faultCode, faultString, extra=None):
- def __init__(self, extra = None):
- faultString = "FORBIDDEN:"
- SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
+
+ def __init__(self, extra=None):
+ faultString = "FORBIDDEN"
+ SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
+
+
+class BadArgs(SfaFault):
+
+ def __init__(self, extra=None):
+ faultString = "BADARGS"
+ SfaFault.__init__(self, GENICODE.BADARGS, faultString, extra)
+
- SfaFault.__init__(self, GENICODE.CREDENTIAL_MISMATCH, faultString, extra)
+ SfaFault.__init__(self, GENICODE.CREDENTIAL_MISMATCH,
+ faultString, extra)
+
- def __init__(self, method, interface = None, extra = None):
+
+ def __init__(self, method, interface=None, extra=None):
faultString = "Invalid method " + method
if interface:
faultString += " for interface " + interface
SfaFault.__init__(self, GENICODE.UNSUPPORTED, faultString, extra)
faultString = "Invalid method " + method
if interface:
faultString += " for interface " + interface
SfaFault.__init__(self, GENICODE.UNSUPPORTED, faultString, extra)
- def __init__(self, got, min, max = min, extra = None):
+
+ def __init__(self, got, min, max=min, extra=None):
(expected, got)
SfaFault.__init__(self, GENICODE.BADARGS, faultString, extra)
(expected, got)
SfaFault.__init__(self, GENICODE.BADARGS, faultString, extra)
if name is not None:
faultString = "Invalid %s value" % name
else:
faultString = "Invalid argument"
SfaFault.__init__(self, GENICODE.BADARGS, faultString, extra)
if name is not None:
faultString = "Invalid %s value" % name
else:
faultString = "Invalid argument"
SfaFault.__init__(self, GENICODE.BADARGS, faultString, extra)
faultString = "Failed to authenticate call"
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
faultString = "Failed to authenticate call"
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
faultString = "Database error"
SfaFault.__init__(self, GENICODE.DBERROR, faultString, extra)
faultString = "Database error"
SfaFault.__init__(self, GENICODE.DBERROR, faultString, extra)
faultString = "Permission denied"
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
faultString = "Permission denied"
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
SfaFault.__init__(self, GENICODE.UNSUPPORTED, faultString, extra)
SfaFault.__init__(self, GENICODE.UNSUPPORTED, faultString, extra)
- def __init__(self, extra = None):
- faultString = "Internal API error"
+
+ def __init__(self, extra=None):
+ faultString = "Internal SFA API error"
SfaFault.__init__(self, GENICODE.SERVERERROR, faultString, extra)
SfaFault.__init__(self, GENICODE.SERVERERROR, faultString, extra)
self.value = value
faultString = "Malformed HRN: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, extra)
self.value = value
faultString = "Malformed HRN: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, extra)
self.value = value
faultString = "Tree Exception: %(value)s, " % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Tree Exception: %(value)s, " % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "%s does not exist here " % self.value
SfaFault.__init__(self, GENICODE.SEARCHFAILED, faultString, extra)
self.value = value
faultString = "%s does not exist here " % self.value
SfaFault.__init__(self, GENICODE.SEARCHFAILED, faultString, extra)
self.value = value
faultString = "Non exsiting record %(value)s, " % locals()
SfaFault.__init__(self, GENICODE.SEARCHFAILED, faultString, extra)
self.value = value
faultString = "Non exsiting record %(value)s, " % locals()
SfaFault.__init__(self, GENICODE.SEARCHFAILED, faultString, extra)
self.value = value
faultString = "Existing record: %(value)s, " % locals()
SfaFault.__init__(self, GENICODE.REFUSED, faultString, extra)
self.value = value
faultString = "Existing record: %(value)s, " % locals()
SfaFault.__init__(self, GENICODE.REFUSED, faultString, extra)
self.value = value
faultString = "Invalid RPC Params: %(value)s, " % locals()
SfaFault.__init__(self, GENICODE.RPCERROR, faultString, extra)
self.value = value
faultString = "Invalid RPC Params: %(value)s, " % locals()
SfaFault.__init__(self, GENICODE.RPCERROR, faultString, extra)
- SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
+ SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
+
- SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
+ SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
+
self.value = value
faultString = "Record not found: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Record not found: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Unknown SFA Type: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Unknown SFA Type: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Missing authority: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Missing authority: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "PlanetLab record does not exist : %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "PlanetLab record does not exist : %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Permission error: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
self.value = value
faultString = "Permission error: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
self.value = value
faultString = "Insufficient rights: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
self.value = value
faultString = "Insufficient rights: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
self.value = value
faultString = "Missing delegate bit: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
self.value = value
faultString = "Missing delegate bit: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
self.value = value
faultString = "Child rights not subset of parent: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
self.value = value
faultString = "Child rights not subset of parent: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
self.value = value
faultString = "Cert missing parent: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Cert missing parent: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Cert not signed by parent: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Cert not signed by parent: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "GID invalid parent hrn: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "GID invalid parent hrn: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Sliver does not exist : %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Sliver does not exist : %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
-class BadRequestHash(xmlrpclib.Fault):
- def __init__(self, hash = None, extra = None):
+
+class BadRequestHash(xmlrpc_client.Fault):
+
+ def __init__(self, hash=None, extra=None):
- faultString = "Trusted root directory does not exist: %(value)s" % locals()
- SfaFault.__init__(self, GENICODE.SERVERERROR, faultString, extra)
+ faultString = "Trusted root directory does not exist: %(value)s" % locals(
+ )
+ SfaFault.__init__(self, GENICODE.SERVERERROR, faultString, extra)
+
- SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
+ SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
+
self.value = value
faultString = "Invalid RSpec: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Invalid RSpec: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Invalid RSpec version: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.BADVERSION, faultString, extra)
self.value = value
faultString = "Invalid RSpec version: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.BADVERSION, faultString, extra)
self.value = value
faultString = "Unsupported RSpec version: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.UNSUPPORTED, faultString, extra)
self.value = value
faultString = "Unsupported RSpec version: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.UNSUPPORTED, faultString, extra)
self.value = value
faultString = "Invalid RSpec Element: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
self.value = value
faultString = "Invalid RSpec Element: %(value)s" % locals()
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
- SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
+ SfaFault.__init__(self, GENICODE.BADARGS, faultString, extra)
+
faultString = "Account Disabled"
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
faultString = "Account Disabled"
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
- faultString = "Unable to verify credential: %(value)s, " %locals()
- SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
+ faultString = "Unable to verify credential" % locals()
+ if value:
+ faultString += ": %s" % value
+ faultString += ", "
+ SfaFault.__init__(self, GENICODE.BADARGS, faultString, extra)
+
def __init__(self, value, extra=None):
self.value = value
faultString = "%s cert is expired" % value
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
def __init__(self, value, extra=None):
self.value = value
faultString = "%s cert is expired" % value
SfaFault.__init__(self, GENICODE.ERROR, faultString, extra)
- SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
+ SfaFault.__init__(self, GENICODE.FORBIDDEN, faultString, extra)
+
def __init__(self, value, extra=None):
self.value = value
faultString = "Unsupported operation: %s" % value
def __init__(self, value, extra=None):
self.value = value
faultString = "Unsupported operation: %s" % value
- SfaFault.__init__(self, GENICODE.UNSUPPORTED, faultString, extra)
-
+ SfaFault.__init__(self, GENICODE.UNSUPPORTED, faultString, extra)