parent
27b9133ad4
commit
72fedefb7f
1 changed files with 2 additions and 1 deletions
|
|
@ -663,6 +663,7 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
|||
return mark_safe(f"<ul>{error_items}</ul>")
|
||||
|
||||
@classmethod
|
||||
@transaction.atomic
|
||||
def create_instance(cls, name, organization, context, created_by, spec_data):
|
||||
# Ensure the namespace exists
|
||||
context.control_plane.get_or_create_namespace(organization)
|
||||
|
|
@ -710,7 +711,7 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
|||
body=create_data,
|
||||
)
|
||||
except Exception as e:
|
||||
instance.delete()
|
||||
# Transaction will automatically roll back the instance creation
|
||||
if isinstance(e, ApiException):
|
||||
try:
|
||||
error_body = json.loads(e.body)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue