Merge branch 'master' into feature/6561/invoices-webhook
This commit is contained in:
commit
6873d901c9
25 changed files with 892 additions and 182 deletions
|
|
@ -1282,6 +1282,10 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
|
|||
context['vm']['total_price'] = (
|
||||
price + vat - discount['amount']
|
||||
)
|
||||
except TypeError:
|
||||
logger.error("Type error. Probably we "
|
||||
"came from a generic product. "
|
||||
"Invoice ID %s" % obj.invoice_id)
|
||||
except WrongIdError:
|
||||
logger.error("WrongIdError while accessing "
|
||||
"invoice {}".format(obj.invoice_id))
|
||||
|
|
@ -1587,6 +1591,7 @@ class VirtualMachineView(LoginRequiredMixin, View):
|
|||
|
||||
# Cancel Stripe subscription
|
||||
stripe_utils = StripeUtils()
|
||||
hosting_order = None
|
||||
try:
|
||||
hosting_order = HostingOrder.objects.get(
|
||||
vm_id=vm.id
|
||||
|
|
@ -1648,9 +1653,10 @@ class VirtualMachineView(LoginRequiredMixin, View):
|
|||
else:
|
||||
sleep(2)
|
||||
if not response['status']:
|
||||
response['text'] = _("VM terminate action timed out. Please "
|
||||
"contact support@datacenterlight.ch for "
|
||||
"further information.")
|
||||
response['text'] = str(_("VM terminate action timed out. "
|
||||
"Please contact "
|
||||
"support@datacenterlight.ch for "
|
||||
"further information."))
|
||||
context = {
|
||||
'vm_name': vm_name,
|
||||
'base_url': "{0}://{1}".format(
|
||||
|
|
@ -1671,6 +1677,11 @@ class VirtualMachineView(LoginRequiredMixin, View):
|
|||
email = BaseEmail(**email_data)
|
||||
email.send()
|
||||
admin_email_body.update(response)
|
||||
admin_email_body["customer_email"] = owner.email
|
||||
admin_email_body["VM_ID"] = vm.id
|
||||
admin_email_body["VM_created_at"] = (str(hosting_order.created_at) if
|
||||
hosting_order is not None
|
||||
else "unknown")
|
||||
admin_msg_sub = "VM and Subscription for VM {} and user: {}".format(
|
||||
vm.id,
|
||||
owner.email
|
||||
|
|
@ -1760,7 +1771,8 @@ class CheckUserVM(APIView):
|
|||
response = check_otp(user, realm, token)
|
||||
if response != 200:
|
||||
return Response('Invalid token', 403)
|
||||
manager = OpenNebulaManager()
|
||||
manager = OpenNebulaManager(settings.OPENNEBULA_USERNAME,
|
||||
settings.OPENNEBULA_PASSWORD)
|
||||
# not the best way to lookup vms by ip
|
||||
# TODO: make this optimal
|
||||
vms = manager.get_vms()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue