Tentative fix for error 500 on order details page
This commit is contained in:
parent
e9643c4783
commit
5b4e9b733d
4 changed files with 27 additions and 6 deletions
|
@ -4,6 +4,19 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="order-detail-container">
|
<div class="order-detail-container">
|
||||||
|
{% if messages %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-md-8 col-md-offset-2">
|
||||||
|
<br/>
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
{% for message in messages %}
|
||||||
|
<span>{{ message }}</span>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if not error %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-8 col-md-offset-2">
|
<div class="col-xs-12 col-md-8 col-md-offset-2">
|
||||||
<div class="invoice-title">
|
<div class="invoice-title">
|
||||||
|
@ -66,5 +79,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{%endblock%}
|
{%endblock%}
|
||||||
|
|
|
@ -33,9 +33,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" class="btn btn-default"><a
|
<a class="btn btn-default"
|
||||||
href="{% url 'hosting:orders' order.id %}">{% trans "View Detail"%}</a>
|
href="{% url 'hosting:orders' order.id %}">{% trans "View Detail"%}</a>
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-default" data-toggle="modal"
|
<button type="button" class="btn btn-default" data-toggle="modal"
|
||||||
data-target="#Modal{{ order.id }}"><a
|
data-target="#Modal{{ order.id }}"><a
|
||||||
href="#">{% trans "Cancel Order"%}</a>
|
href="#">{% trans "Cancel Order"%}</a>
|
||||||
|
|
|
@ -35,7 +35,7 @@ from opennebula_api.serializers import VirtualMachineSerializer,\
|
||||||
|
|
||||||
|
|
||||||
from oca.exceptions import OpenNebulaException
|
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 = "Your VMs cannot be displayed at the moment due to a backend \
|
||||||
connection error. please try again in a few minutes."
|
connection error. please try again in a few minutes."
|
||||||
|
@ -583,8 +583,15 @@ class OrdersHostingDetailView(PermissionRequiredMixin, LoginRequiredMixin, Detai
|
||||||
try:
|
try:
|
||||||
vm = manager.get_vm(obj.vm_id)
|
vm = manager.get_vm(obj.vm_id)
|
||||||
context['vm'] = VirtualMachineSerializer(vm).data
|
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:
|
except ConnectionRefusedError:
|
||||||
messages.error(request,
|
messages.error(self.request,
|
||||||
'In order to create a VM, you need to create/upload your SSH KEY first.'
|
'In order to create a VM, you need to create/upload your SSH KEY first.'
|
||||||
)
|
)
|
||||||
return context
|
return context
|
||||||
|
|
|
@ -2,7 +2,7 @@ import oca
|
||||||
import socket
|
import socket
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from oca.pool import WrongNameError
|
from oca.pool import WrongNameError, WrongIdError
|
||||||
from oca.exceptions import OpenNebulaException
|
from oca.exceptions import OpenNebulaException
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -204,6 +204,8 @@ class OpenNebulaManager():
|
||||||
try:
|
try:
|
||||||
vm_pool = self._get_vm_pool()
|
vm_pool = self._get_vm_pool()
|
||||||
return vm_pool.get_by_id(vm_id)
|
return vm_pool.get_by_id(vm_id)
|
||||||
|
except WrongIdError:
|
||||||
|
raise WrongIdError
|
||||||
except:
|
except:
|
||||||
raise ConnectionRefusedError
|
raise ConnectionRefusedError
|
||||||
|
|
||||||
|
@ -449,7 +451,6 @@ class OpenNebulaManager():
|
||||||
"""
|
"""
|
||||||
# TODO: Check if we can remove this first try because we basically just
|
# TODO: Check if we can remove this first try because we basically just
|
||||||
# raise the possible Errors
|
# raise the possible Errors
|
||||||
|
|
||||||
try:
|
try:
|
||||||
open_user = self._get_user(user)
|
open_user = self._get_user(user)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue