1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Changed instance info in template and deleting process

This commit is contained in:
Retspen 2015-07-09 10:41:56 +03:00
parent d73e8c72e7
commit b819b91d19
2 changed files with 58 additions and 52 deletions

View file

@ -243,25 +243,27 @@ def instance(request, compute_id, vname):
if 'delete' in request.POST:
if conn.get_status() == 1:
conn.force_shutdown()
try:
instance = Instance.objects.get(compute_id=compute_id, name=vname)
instance_name = instance.name
instance.delete()
if request.POST.get('delete_disk', ''):
conn.delete_disk()
finally:
msg = _("Destroy")
addlogmsg(request.user.username, instance_name, msg)
if not request.user.is_superuser:
del_userinstance = UserInstance.objects.get(id=userinstace.id)
if request.POST.get('delete_disk', ''):
conn.delete_disk()
conn.delete()
instance = Instance.objects.get(compute_id=compute_id, name=vname)
instance_name = instance.name
instance.delete()
if not request.user.is_superuser:
del_userinstance = UserInstance.objects.get(id=userinstace.id)
del_userinstance.delete()
else:
try:
del_userinstance = UserInstance.objects.filter(instance__compute_id=compute_id, instance__name=vname)
del_userinstance.delete()
else:
try:
del_userinstance = UserInstance.objects.filter(instance__compute_id=compute_id, instance__name=vname)
del_userinstance.delete()
except UserInstance.DoesNotExist:
pass
conn.delete()
except UserInstance.DoesNotExist:
pass
msg = _("Destroy")
addlogmsg(request.user.username, instance_name, msg)
return HttpResponseRedirect(reverse('instances'))
if 'rootpasswd' in request.POST: