1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-21 18:03:54 +03:00

* Fixed calendar, so next execution updates correctly on calendar rule

edition
This commit is contained in:
Adolfo Gómez García 2017-11-06 10:56:35 +01:00
parent 238f08b7dd
commit 417ddc6d8d
5 changed files with 21 additions and 6 deletions

View File

@ -65,6 +65,7 @@ def login():
return 0
def logout():
global headers
h = Http()

View File

@ -46,7 +46,7 @@ import six
import bitarray
import logging
__updated__ = '2016-10-31'
__updated__ = '2017-11-06'
logger = logging.getLogger(__name__)
@ -185,5 +185,4 @@ class CalendarChecker(object):
def debug(self):
return "Calendar checker for {}".format(self.calendar)

View File

@ -34,7 +34,7 @@
from __future__ import unicode_literals
__updated__ = '2016-04-05'
__updated__ = '2017-11-06'
from django.db import models
from uds.models.UUIDModel import UUIDModel
@ -61,5 +61,17 @@ class Calendar(UUIDModel, TaggingMixin):
db_table = 'uds_calendar'
app_label = 'uds'
def save(self, *args, **kwargs):
logger.debug('Saving calendar')
res = UUIDModel.save(self, *args, **kwargs)
try:
for v in self.calendaraction_set.all(): v.save()
except Exception:
pass
return res
def __str__(self):
return 'Calendar "{}" modified on {} with {} rules'.format(self.name, self.modified, self.rules.count())

View File

@ -33,7 +33,7 @@
from __future__ import unicode_literals
__updated__ = '2016-10-31'
__updated__ = '2017-11-06'
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@ -153,9 +153,10 @@ class CalendarRule(UUIDModel):
def save(self, *args, **kwargs):
logger.debug('Saving...')
self.calendar.modified = getSqlDatetime()
self.calendar.save()
return UUIDModel.save(self, *args, **kwargs)
res = UUIDModel.save(self, *args, **kwargs)
self.calendar.save()
return res
def __str__(self):
return 'Rule {0}: {1}-{2}, {3}, Interval: {4}, duration: {5}'.format(self.name, self.start, self.end, self.frequency, self.interval, self.duration)

View File

@ -231,6 +231,8 @@ class OpenGnsysClient(object):
@ensureConnected
def notifyDeadline(self, machineId, deadLine):
ou, lab, client = machineId.split('.')
if deadLine is None:
deadLine = 0
errMsg = 'Notifying deadline'
data = {
'deadLine': deadLine