support hardcoded suspend plan for exoscale
All checks were successful
Tests / test (push) Successful in 27s

This commit is contained in:
Tobias Brunner 2025-11-17 11:48:19 +01:00
parent 208f3c357d
commit 3e17e03da9
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ

View file

@ -233,6 +233,9 @@ The Servala Team"""
try:
service = Service.objects.get(osb_service_id=service_id)
# Special handling: when plan_id is "suspend", don't lookup service_offering
service_offering = None
if plan_id != "suspend":
service_offering = ServiceOffering.objects.get(
osb_plan_id=plan_id, service=service
)
@ -258,7 +261,7 @@ The Servala Team"""
return self.request.build_absolute_uri(admin_path)
def _create_action_helpdesk_ticket(
self, request, action, instance_id, service, service_offering, users=None
self, request, action, instance_id, service, service_offering=None, users=None
):
"""
Create an Odoo helpdesk ticket for offboarding or suspension actions.
@ -269,11 +272,12 @@ The Servala Team"""
organization = None
try:
# Look for instances with this name in the service offering's context
filter_kwargs = {"name": instance_id}
if service_offering:
filter_kwargs["context__service_offering"] = service_offering
service_instance = (
ServiceInstance.objects.filter(
name=instance_id,
context__service_offering=service_offering,
)
ServiceInstance.objects.filter(**filter_kwargs)
.select_related("organization")
.first()
)
@ -302,6 +306,7 @@ The Servala Team"""
else:
description_parts.append(f"Instance: {instance_id}")
if service_offering:
offering_url = self._get_admin_url(
"core_serviceoffering_change", service_offering.pk
)