Merge "cloud: Remove use of OpenStackCloudCreateException"
This commit is contained in:
commit
05279611f9
|
@ -54,6 +54,7 @@ def assert_no_deprecated_exceptions(logical_line, filename):
|
|||
return
|
||||
|
||||
for exception in (
|
||||
'OpenStackCloudCreateException',
|
||||
'OpenStackCloudTimeout',
|
||||
'OpenStackCloudHTTPError',
|
||||
'OpenStackCloudBadRequest',
|
||||
|
|
|
@ -984,10 +984,26 @@ class ComputeCloudMixin:
|
|||
admin_pass = server.admin_password or kwargs.get('admin_pass')
|
||||
if not wait:
|
||||
server = self.compute.get_server(server.id)
|
||||
if server.status == 'ERROR':
|
||||
raise exc.OpenStackCloudCreateException(
|
||||
resource='server', resource_id=server.id
|
||||
if server['status'] == 'ERROR':
|
||||
if (
|
||||
'fault' in server
|
||||
and server['fault'] is not None
|
||||
and 'message' in server['fault']
|
||||
):
|
||||
raise exceptions.SDKException(
|
||||
"Error in creating the server. "
|
||||
"Compute service reports fault: {reason}".format(
|
||||
reason=server['fault']['message']
|
||||
),
|
||||
extra_data=dict(server=server),
|
||||
)
|
||||
|
||||
raise exceptions.SDKException(
|
||||
"Error in creating the server "
|
||||
"(no further information available)",
|
||||
extra_data=dict(server=server),
|
||||
)
|
||||
|
||||
server = meta.add_server_interfaces(self, server)
|
||||
|
||||
else:
|
||||
|
@ -1173,16 +1189,16 @@ class ComputeCloudMixin:
|
|||
and 'message' in server['fault']
|
||||
):
|
||||
raise exceptions.SDKException(
|
||||
"Error in creating the server."
|
||||
" Compute service reports fault: {reason}".format(
|
||||
"Error in creating the server. "
|
||||
"Compute service reports fault: {reason}".format(
|
||||
reason=server['fault']['message']
|
||||
),
|
||||
extra_data=dict(server=server),
|
||||
)
|
||||
|
||||
raise exceptions.SDKException(
|
||||
"Error in creating the server"
|
||||
" (no further information available)",
|
||||
"Error in creating the server "
|
||||
"(no further information available)",
|
||||
extra_data=dict(server=server),
|
||||
)
|
||||
|
||||
|
|
|
@ -17,6 +17,15 @@ from openstack import exceptions
|
|||
OpenStackCloudException = exceptions.SDKException
|
||||
|
||||
|
||||
class OpenStackCloudUnavailableExtension(OpenStackCloudException):
|
||||
pass
|
||||
|
||||
|
||||
class OpenStackCloudUnavailableFeature(OpenStackCloudException):
|
||||
pass
|
||||
|
||||
|
||||
# Backwards compat. These are deprecated and should not be used in new code.
|
||||
class OpenStackCloudCreateException(OpenStackCloudException):
|
||||
def __init__(self, resource, resource_id, extra_data=None, **kwargs):
|
||||
super(OpenStackCloudCreateException, self).__init__(
|
||||
|
@ -29,15 +38,6 @@ class OpenStackCloudCreateException(OpenStackCloudException):
|
|||
self.resource_id = resource_id
|
||||
|
||||
|
||||
class OpenStackCloudUnavailableExtension(OpenStackCloudException):
|
||||
pass
|
||||
|
||||
|
||||
class OpenStackCloudUnavailableFeature(OpenStackCloudException):
|
||||
pass
|
||||
|
||||
|
||||
# Backwards compat. These are deprecated and should not be used in new code.
|
||||
OpenStackCloudTimeout = exceptions.ResourceTimeout
|
||||
OpenStackCloudHTTPError = exceptions.HttpException
|
||||
OpenStackCloudBadRequest = exceptions.BadRequestException
|
||||
|
|
Loading…
Reference in New Issue