cloud: Remove use of OpenStackCloudCreateException
We'd like to get rid of the openstack.cloud.exc module. This exception has one user so it is an easy cull. Change-Id: I9b6a96d3b4d66ed69d87ba2a1d27bee9bab8c98d Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
5de45a329d
commit
f90fd9a307
@ -54,6 +54,7 @@ def assert_no_deprecated_exceptions(logical_line, filename):
|
||||
return
|
||||
|
||||
for exception in (
|
||||
'OpenStackCloudCreateException',
|
||||
'OpenStackCloudTimeout',
|
||||
'OpenStackCloudHTTPError',
|
||||
'OpenStackCloudBadRequest',
|
||||
|
@ -983,10 +983,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:
|
||||
@ -1172,16 +1188,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
Block a user