mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
once
might already be a datetime object
This commit is contained in:
parent
88c0420fc2
commit
b27bbc258c
@ -949,16 +949,17 @@ class Schedule(object):
|
||||
not data['_splay']:
|
||||
continue
|
||||
|
||||
if not data['_next_fire_time'] and \
|
||||
not data['_splay']:
|
||||
once_fmt = data.get('once_fmt', '%Y-%m-%dT%H:%M:%S')
|
||||
try:
|
||||
once = datetime.datetime.strptime(data['once'],
|
||||
once_fmt)
|
||||
except (TypeError, ValueError):
|
||||
log.error('Date string could not be parsed: %s, %s',
|
||||
data['once'], once_fmt)
|
||||
continue
|
||||
if not data['_next_fire_time'] and not data['_splay']:
|
||||
once = data['once']
|
||||
if not isinstance(once, datetime.datetime):
|
||||
once_fmt = data.get('once_fmt', '%Y-%m-%dT%H:%M:%S')
|
||||
try:
|
||||
once = datetime.datetime.strptime(data['once'],
|
||||
once_fmt)
|
||||
except (TypeError, ValueError):
|
||||
log.error('Date string could not be parsed: %s, %s',
|
||||
data['once'], once_fmt)
|
||||
continue
|
||||
# If _next_fire_time is less than now or greater
|
||||
# than now, continue.
|
||||
if once < now - loop_interval:
|
||||
|
Loading…
Reference in New Issue
Block a user