support hardcoded suspend plan for exoscale
All checks were successful
Tests / test (push) Successful in 27s
All checks were successful
Tests / test (push) Successful in 27s
This commit is contained in:
parent
208f3c357d
commit
3e17e03da9
1 changed files with 17 additions and 12 deletions
|
|
@ -233,6 +233,9 @@ The Servala Team"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
service = Service.objects.get(osb_service_id=service_id)
|
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(
|
service_offering = ServiceOffering.objects.get(
|
||||||
osb_plan_id=plan_id, service=service
|
osb_plan_id=plan_id, service=service
|
||||||
)
|
)
|
||||||
|
|
@ -258,7 +261,7 @@ The Servala Team"""
|
||||||
return self.request.build_absolute_uri(admin_path)
|
return self.request.build_absolute_uri(admin_path)
|
||||||
|
|
||||||
def _create_action_helpdesk_ticket(
|
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.
|
Create an Odoo helpdesk ticket for offboarding or suspension actions.
|
||||||
|
|
@ -269,11 +272,12 @@ The Servala Team"""
|
||||||
organization = None
|
organization = None
|
||||||
try:
|
try:
|
||||||
# Look for instances with this name in the service offering's context
|
# 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 = (
|
service_instance = (
|
||||||
ServiceInstance.objects.filter(
|
ServiceInstance.objects.filter(**filter_kwargs)
|
||||||
name=instance_id,
|
|
||||||
context__service_offering=service_offering,
|
|
||||||
)
|
|
||||||
.select_related("organization")
|
.select_related("organization")
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
|
|
@ -302,6 +306,7 @@ The Servala Team"""
|
||||||
else:
|
else:
|
||||||
description_parts.append(f"Instance: {instance_id}")
|
description_parts.append(f"Instance: {instance_id}")
|
||||||
|
|
||||||
|
if service_offering:
|
||||||
offering_url = self._get_admin_url(
|
offering_url = self._get_admin_url(
|
||||||
"core_serviceoffering_change", service_offering.pk
|
"core_serviceoffering_change", service_offering.pk
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue