Commit 82073b6f by Bach Dániel

one: random fixes

fixes #117
parent 3f526ee4
...@@ -171,6 +171,8 @@ def update_state(one_id): ...@@ -171,6 +171,8 @@ def update_state(one_id):
(out, err) = proc.communicate() (out, err) = proc.communicate()
state = 'UNKNOWN' state = 'UNKNOWN'
try: try:
if(len(sys.argv) == 3 and sys.argv[2] == 'UNKNOWN'):
raise Exception(':(')
from xml.dom.minidom import parse, parseString from xml.dom.minidom import parse, parseString
x = parseString(out) x = parseString(out)
state = x.getElementsByTagName("STATE")[0].childNodes[0].nodeValue state = x.getElementsByTagName("STATE")[0].childNodes[0].nodeValue
......
...@@ -28,7 +28,8 @@ class Job(HourlyJob): ...@@ -28,7 +28,8 @@ class Job(HourlyJob):
# print i+':'+unicode(d[i]) # print i+':'+unicode(d[i])
# delete # 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: try:
translation.activate(i.owner.person_set.get().language) translation.activate(i.owner.person_set.get().language)
except: except:
...@@ -47,7 +48,8 @@ class Job(HourlyJob): ...@@ -47,7 +48,8 @@ class Job(HourlyJob):
SendMailTask.delay(to=i.owner.email, subject='[IK Cloud] %s' % i.name, msg=msg) SendMailTask.delay(to=i.owner.email, subject='[IK Cloud] %s' % i.name, msg=msg)
# suspend # 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: try:
translation.activate(i.owner.person_set.get().language) translation.activate(i.owner.person_set.get().language)
except: except:
......
...@@ -571,6 +571,8 @@ class Instance(models.Model): ...@@ -571,6 +571,8 @@ class Instance(models.Model):
if self.template.state != "DONE": if self.template.state != "DONE":
self.check_if_is_save_as_done() self.check_if_is_save_as_done()
if self.one_id and self.state != 'DONE': if self.one_id and self.state != 'DONE':
self.waiting = True
self.save()
from .tasks import DeleteInstanceTask from .tasks import DeleteInstanceTask
DeleteInstanceTask.delay(one_id=self.one_id) DeleteInstanceTask.delay(one_id=self.one_id)
self.firewall_host_delete() 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