mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixing a reported issue when using a scheduled job from pillar with splay. _seconds element that acted as a backup of the actual seconds was being removed when pillar was refreshed and causing exceptions. This fix moves some splay related code out of the if else condition so it's checked whether the job is in the job queue or not.
This commit is contained in:
parent
900c7a510f
commit
bfa6d25ed8
1 changed files with 15 additions and 12 deletions
|
@ -639,6 +639,21 @@ class Schedule(object):
|
|||
self.loop_interval = seconds
|
||||
run = False
|
||||
|
||||
if 'splay' in data:
|
||||
if 'when' in data:
|
||||
log.error('Unable to use "splay" with "when" option at this time. Ignoring.')
|
||||
elif 'cron' in data:
|
||||
log.error('Unable to use "splay" with "cron" option at this time. Ignoring.')
|
||||
else:
|
||||
if '_seconds' not in data:
|
||||
log.debug('The _seconds parameter is missing, '
|
||||
'most likely the first run or the schedule '
|
||||
'has been refreshed refresh.')
|
||||
if 'seconds' in data:
|
||||
data['_seconds'] = data['seconds']
|
||||
else:
|
||||
data['_seconds'] = 0
|
||||
|
||||
if job in self.intervals:
|
||||
if 'when' in data:
|
||||
if seconds == 0:
|
||||
|
@ -652,18 +667,6 @@ class Schedule(object):
|
|||
if now - self.intervals[job] >= seconds:
|
||||
run = True
|
||||
else:
|
||||
if 'splay' in data:
|
||||
if 'when' in data:
|
||||
log.error('Unable to use "splay" with "when" option at this time. Ignoring.')
|
||||
elif 'cron' in data:
|
||||
log.error('Unable to use "splay" with "cron" option at this time. Ignoring.')
|
||||
else:
|
||||
if 'seconds' in data:
|
||||
log.debug('breakage here')
|
||||
data['_seconds'] = data['seconds']
|
||||
else:
|
||||
data['_seconds'] = 0
|
||||
|
||||
if 'when' in data:
|
||||
if seconds == 0:
|
||||
if data['_when_run']:
|
||||
|
|
Loading…
Add table
Reference in a new issue