October feature list #226
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>")
|
return mark_safe(f"<ul>{error_items}</ul>")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@transaction.atomic
|
||||||
def create_instance(cls, name, organization, context, created_by, spec_data):
|
def create_instance(cls, name, organization, context, created_by, spec_data):
|
||||||
# Ensure the namespace exists
|
# Ensure the namespace exists
|
||||||
context.control_plane.get_or_create_namespace(organization)
|
context.control_plane.get_or_create_namespace(organization)
|
||||||
|
|
@ -710,7 +711,7 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
||||||
body=create_data,
|
body=create_data,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
instance.delete()
|
# Transaction will automatically roll back the instance creation
|
||||||
if isinstance(e, ApiException):
|
if isinstance(e, ApiException):
|
||||||
try:
|
try:
|
||||||
error_body = json.loads(e.body)
|
error_body = json.loads(e.body)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue