Capitalize SDK more reasonably in an exception name
Change-Id: I0902cfc5f487852cb09f596fe75a8f77807da9e7
This commit is contained in:
@@ -34,14 +34,14 @@ class ServiceFilter(object):
|
|||||||
self.service_type = service_type
|
self.service_type = service_type
|
||||||
if not service_type:
|
if not service_type:
|
||||||
msg = "Service type must be specified to locate service"
|
msg = "Service type must be specified to locate service"
|
||||||
raise exceptions.SdkException(msg)
|
raise exceptions.SDKException(msg)
|
||||||
if not visibility:
|
if not visibility:
|
||||||
msg = "Visibility must be specified to locate service"
|
msg = "Visibility must be specified to locate service"
|
||||||
raise exceptions.SdkException(msg)
|
raise exceptions.SDKException(msg)
|
||||||
visibility = visibility.rstrip('URL')
|
visibility = visibility.rstrip('URL')
|
||||||
if visibility not in self.VISIBILITY:
|
if visibility not in self.VISIBILITY:
|
||||||
msg = "Visibility <%s> not in %s" % (visibility, self.VISIBILITY)
|
msg = "Visibility <%s> not in %s" % (visibility, self.VISIBILITY)
|
||||||
raise exceptions.SdkException(msg)
|
raise exceptions.SDKException(msg)
|
||||||
self.visibility = visibility
|
self.visibility = visibility
|
||||||
self.region = region
|
self.region = region
|
||||||
self.service_name = service_name
|
self.service_name = service_name
|
||||||
|
|||||||
@@ -17,18 +17,18 @@ Exception definitions.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class SdkException(Exception):
|
class SDKException(Exception):
|
||||||
"""The base exception class for all exceptions this library raises.
|
"""The base exception class for all exceptions this library raises.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AuthorizationFailure(SdkException):
|
class AuthorizationFailure(SDKException):
|
||||||
"""Cannot authorize API client."""
|
"""Cannot authorize API client."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class EndpointException(SdkException):
|
class EndpointException(SDKException):
|
||||||
"""Something is rotten in Service Catalog."""
|
"""Something is rotten in Service Catalog."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -43,12 +43,12 @@ class EmptyCatalog(EndpointNotFound):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NoMatchingPlugin(SdkException):
|
class NoMatchingPlugin(SDKException):
|
||||||
"""No matching plugins could be created with the provided parameters."""
|
"""No matching plugins could be created with the provided parameters."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class InvalidResponse(SdkException):
|
class InvalidResponse(SDKException):
|
||||||
"""The response from the server is not valid for this request."""
|
"""The response from the server is not valid for this request."""
|
||||||
|
|
||||||
def __init__(self, response):
|
def __init__(self, response):
|
||||||
@@ -56,12 +56,12 @@ class InvalidResponse(SdkException):
|
|||||||
self.response = response
|
self.response = response
|
||||||
|
|
||||||
|
|
||||||
class HttpException(SdkException):
|
class HttpException(SDKException):
|
||||||
def __init__(self, message, details=None):
|
def __init__(self, message, details=None):
|
||||||
super(HttpException, self).__init__(message)
|
super(HttpException, self).__init__(message)
|
||||||
self.details = details
|
self.details = details
|
||||||
|
|
||||||
|
|
||||||
class MethodNotSupported(SdkException):
|
class MethodNotSupported(SDKException):
|
||||||
"""The resource does not support this operation type."""
|
"""The resource does not support this operation type."""
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ class TestServiceFilter(testtools.TestCase):
|
|||||||
sot = filt.ServiceFilter('identity', visibility='adminURL')
|
sot = filt.ServiceFilter('identity', visibility='adminURL')
|
||||||
self.assertEqual("service_type=identity,visibility=admin",
|
self.assertEqual("service_type=identity,visibility=admin",
|
||||||
six.text_type(sot))
|
six.text_type(sot))
|
||||||
self.assertRaises(exceptions.SdkException,
|
self.assertRaises(exceptions.SDKException,
|
||||||
filt.ServiceFilter, 'identity', visibility='b')
|
filt.ServiceFilter, 'identity', visibility='b')
|
||||||
self.assertRaises(exceptions.SdkException, filt.ServiceFilter,
|
self.assertRaises(exceptions.SDKException, filt.ServiceFilter,
|
||||||
'identity', visibility=None)
|
'identity', visibility=None)
|
||||||
self.assertRaises(exceptions.SdkException, filt.ServiceFilter, None)
|
self.assertRaises(exceptions.SDKException, filt.ServiceFilter, None)
|
||||||
self.assertRaises(exceptions.SdkException, filt.ServiceFilter, None)
|
self.assertRaises(exceptions.SDKException, filt.ServiceFilter, None)
|
||||||
|
|
||||||
def test_match_service_type(self):
|
def test_match_service_type(self):
|
||||||
sot = filt.ServiceFilter('identity')
|
sot = filt.ServiceFilter('identity')
|
||||||
|
|||||||
Reference in New Issue
Block a user