Tentative fix for error 500 on order details page

This commit is contained in:
M.Ravi 2017-06-15 07:30:47 +05:30
commit 5b4e9b733d
4 changed files with 27 additions and 6 deletions

View file

@ -35,7 +35,7 @@ from opennebula_api.serializers import VirtualMachineSerializer,\
from oca.exceptions import OpenNebulaException
from oca.pool import WrongNameError
from oca.pool import WrongNameError, WrongIdError
CONNECTION_ERROR = "Your VMs cannot be displayed at the moment due to a backend \
connection error. please try again in a few minutes."
@ -583,8 +583,15 @@ class OrdersHostingDetailView(PermissionRequiredMixin, LoginRequiredMixin, Detai
try:
vm = manager.get_vm(obj.vm_id)
context['vm'] = VirtualMachineSerializer(vm).data
except WrongIdError:
messages.error(self.request,
'The VM you are looking for is unavailable at the moment. \
Please contact Data Center Light support.'
)
self.kwargs['error'] = 'WrongIdError'
context['error'] = 'WrongIdError'
except ConnectionRefusedError:
messages.error(request,
messages.error(self.request,
'In order to create a VM, you need to create/upload your SSH KEY first.'
)
return context