Merge pull request #344 from pcoder/bug/3256/view_details_500_error
Bug/3256/view details 500 error
This commit is contained in:
commit
93bc6ac458
5 changed files with 27 additions and 6 deletions
Binary file not shown.
|
@ -4,7 +4,20 @@
|
|||
{% block content %}
|
||||
|
||||
<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="col-xs-12 col-md-8 col-md-offset-2">
|
||||
<div class="invoice-title">
|
||||
<h2>{% trans "Invoice"%}</h2><h3 class="pull-right">{% trans "Order #"%} {{order.id}}</h3>
|
||||
|
@ -66,5 +79,6 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{%endblock%}
|
||||
|
|
|
@ -33,9 +33,8 @@
|
|||
{% endif %}
|
||||
</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>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-toggle="modal"
|
||||
data-target="#Modal{{ order.id }}"><a
|
||||
href="#">{% trans "Cancel Order"%}</a>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2,7 +2,7 @@ import oca
|
|||
import socket
|
||||
import logging
|
||||
|
||||
from oca.pool import WrongNameError
|
||||
from oca.pool import WrongNameError, WrongIdError
|
||||
from oca.exceptions import OpenNebulaException
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -204,6 +204,8 @@ class OpenNebulaManager():
|
|||
try:
|
||||
vm_pool = self._get_vm_pool()
|
||||
return vm_pool.get_by_id(vm_id)
|
||||
except WrongIdError:
|
||||
raise WrongIdError
|
||||
except:
|
||||
raise ConnectionRefusedError
|
||||
|
||||
|
@ -449,7 +451,6 @@ class OpenNebulaManager():
|
|||
"""
|
||||
# TODO: Check if we can remove this first try because we basically just
|
||||
# raise the possible Errors
|
||||
|
||||
try:
|
||||
open_user = self._get_user(user)
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue