Merge "Record server.id in server creation exception"
This commit is contained in:
commit
1785f26088
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
features:
|
||||
- server creation errors now include the server id in the
|
||||
Exception to allow people to clean up.
|
10
shade/exc.py
10
shade/exc.py
|
@ -54,6 +54,16 @@ class OpenStackCloudException(Exception):
|
|||
return message
|
||||
|
||||
|
||||
class OpenStackCloudCreateException(OpenStackCloudException):
|
||||
|
||||
def __init__(self, resource, resource_id, extra_data=None, **kwargs):
|
||||
super(OpenStackCloudCreateException, self).__init__(
|
||||
message="Error creating {resource}: {resource_id}".format(
|
||||
resource=resource, resource_id=resource_id),
|
||||
extra_data=extra_data, **kwargs)
|
||||
self.resource_id = resource_id
|
||||
|
||||
|
||||
class OpenStackCloudTimeout(OpenStackCloudException):
|
||||
pass
|
||||
|
||||
|
|
|
@ -6605,8 +6605,8 @@ class OpenStackCloud(
|
|||
# going to do the wait loop below, this is a waste of a call
|
||||
server = self.get_server_by_id(server.id)
|
||||
if server.status == 'ERROR':
|
||||
raise OpenStackCloudException(
|
||||
"Error in creating the server.")
|
||||
raise OpenStackCloudCreationException(
|
||||
resource='server', resource_id=server.id)
|
||||
|
||||
if wait:
|
||||
server = self.wait_for_server(
|
||||
|
|
Loading…
Reference in New Issue