Compare commits
No commits in common. "3e17e03da9f290aeed89a68343d2ca98fa2c266b" and "e4c64c4a1777c6211b5b65c204dd6af655617827" have entirely different histories.
3e17e03da9
...
e4c64c4a17
1 changed files with 14 additions and 19 deletions
|
|
@ -233,12 +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
|
||||
)
|
||||
service_offering = ServiceOffering.objects.get(
|
||||
osb_plan_id=plan_id, service=service
|
||||
)
|
||||
except Service.DoesNotExist:
|
||||
return self._error(f"Unknown service_id: {service_id}")
|
||||
except ServiceOffering.DoesNotExist:
|
||||
|
|
@ -261,7 +258,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=None, users=None
|
||||
self, request, action, instance_id, service, service_offering, users=None
|
||||
):
|
||||
"""
|
||||
Create an Odoo helpdesk ticket for offboarding or suspension actions.
|
||||
|
|
@ -272,12 +269,11 @@ 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(**filter_kwargs)
|
||||
ServiceInstance.objects.filter(
|
||||
name=instance_id,
|
||||
context__service_offering=service_offering,
|
||||
)
|
||||
.select_related("organization")
|
||||
.first()
|
||||
)
|
||||
|
|
@ -306,14 +302,13 @@ 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
|
||||
)
|
||||
description_parts.append(f"Service Offering: {offering_url}")
|
||||
offering_url = self._get_admin_url(
|
||||
"core_serviceoffering_change", service_offering.pk
|
||||
)
|
||||
description_parts.append(f"Service Offering: {offering_url}")
|
||||
|
||||
if users:
|
||||
description_parts.append("<br/>Users:")
|
||||
description_parts.append("\nUsers:")
|
||||
for user_data in users:
|
||||
email = user_data.get("email", "N/A")
|
||||
full_name = user_data.get("full_name", "N/A")
|
||||
|
|
@ -329,7 +324,7 @@ The Servala Team"""
|
|||
|
||||
description_parts.append(f" - {full_name} ({user_link}) - {role}")
|
||||
|
||||
description = "<br/>".join(description_parts)
|
||||
description = "\n".join(description_parts)
|
||||
|
||||
create_helpdesk_ticket(
|
||||
title=f"Exoscale OSB {action} - {service.name} - {instance_id}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue