Commit 82073b6f by Bach Dániel

one: random fixes

fixes #117
parent 3f526ee4
......@@ -171,6 +171,8 @@ def update_state(one_id):
(out, err) = proc.communicate()
state = 'UNKNOWN'
try:
if(len(sys.argv) == 3 and sys.argv[2] == 'UNKNOWN'):
raise Exception(':(')
from xml.dom.minidom import parse, parseString
x = parseString(out)
state = x.getElementsByTagName("STATE")[0].childNodes[0].nodeValue
......
......@@ -28,7 +28,8 @@ class Job(HourlyJob):
# print i+':'+unicode(d[i])
# delete
for i in Instance.objects.filter(state__in=['ACTIVE', 'STOPPED'], time_of_delete__isnull=False):
for i in Instance.objects.filter(state__in=['ACTIVE', 'STOPPED'],
time_of_delete__isnull=False, waiting=False):
try:
translation.activate(i.owner.person_set.get().language)
except:
......@@ -47,7 +48,8 @@ class Job(HourlyJob):
SendMailTask.delay(to=i.owner.email, subject='[IK Cloud] %s' % i.name, msg=msg)
# suspend
for i in Instance.objects.filter(state='ACTIVE', time_of_suspend__isnull=False):
for i in Instance.objects.filter(state='ACTIVE',
time_of_suspend__isnull=False, waiting=False):
try:
translation.activate(i.owner.person_set.get().language)
except:
......
......@@ -571,6 +571,8 @@ class Instance(models.Model):
if self.template.state != "DONE":
self.check_if_is_save_as_done()
if self.one_id and self.state != 'DONE':
self.waiting = True
self.save()
from .tasks import DeleteInstanceTask
DeleteInstanceTask.delay(one_id=self.one_id)
self.firewall_host_delete()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment