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
openstack
@ -54,6 +54,7 @@ def assert_no_deprecated_exceptions(logical_line, filename):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for exception in (
|
for exception in (
|
||||||
|
'OpenStackCloudCreateException',
|
||||||
'OpenStackCloudTimeout',
|
'OpenStackCloudTimeout',
|
||||||
'OpenStackCloudHTTPError',
|
'OpenStackCloudHTTPError',
|
||||||
'OpenStackCloudBadRequest',
|
'OpenStackCloudBadRequest',
|
||||||
|
@ -983,10 +983,26 @@ class ComputeCloudMixin:
|
|||||||
admin_pass = server.admin_password or kwargs.get('admin_pass')
|
admin_pass = server.admin_password or kwargs.get('admin_pass')
|
||||||
if not wait:
|
if not wait:
|
||||||
server = self.compute.get_server(server.id)
|
server = self.compute.get_server(server.id)
|
||||||
if server.status == 'ERROR':
|
if server['status'] == 'ERROR':
|
||||||
raise exc.OpenStackCloudCreateException(
|
if (
|
||||||
resource='server', resource_id=server.id
|
'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)
|
server = meta.add_server_interfaces(self, server)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -1172,16 +1188,16 @@ class ComputeCloudMixin:
|
|||||||
and 'message' in server['fault']
|
and 'message' in server['fault']
|
||||||
):
|
):
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
"Error in creating the server."
|
"Error in creating the server. "
|
||||||
" Compute service reports fault: {reason}".format(
|
"Compute service reports fault: {reason}".format(
|
||||||
reason=server['fault']['message']
|
reason=server['fault']['message']
|
||||||
),
|
),
|
||||||
extra_data=dict(server=server),
|
extra_data=dict(server=server),
|
||||||
)
|
)
|
||||||
|
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
"Error in creating the server"
|
"Error in creating the server "
|
||||||
" (no further information available)",
|
"(no further information available)",
|
||||||
extra_data=dict(server=server),
|
extra_data=dict(server=server),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,6 +17,15 @@ from openstack import exceptions
|
|||||||
OpenStackCloudException = exceptions.SDKException
|
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):
|
class OpenStackCloudCreateException(OpenStackCloudException):
|
||||||
def __init__(self, resource, resource_id, extra_data=None, **kwargs):
|
def __init__(self, resource, resource_id, extra_data=None, **kwargs):
|
||||||
super(OpenStackCloudCreateException, self).__init__(
|
super(OpenStackCloudCreateException, self).__init__(
|
||||||
@ -29,15 +38,6 @@ class OpenStackCloudCreateException(OpenStackCloudException):
|
|||||||
self.resource_id = resource_id
|
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
|
OpenStackCloudTimeout = exceptions.ResourceTimeout
|
||||||
OpenStackCloudHTTPError = exceptions.HttpException
|
OpenStackCloudHTTPError = exceptions.HttpException
|
||||||
OpenStackCloudBadRequest = exceptions.BadRequestException
|
OpenStackCloudBadRequest = exceptions.BadRequestException
|
||||||
|
Loading…
x
Reference in New Issue
Block a user