Merge pull request #28238 from basepi/fix.schedule.present.28217

[2015.5] Fix schedule.present always diffing
This commit is contained in:
Mike Place 2015-10-23 07:31:32 -06:00
commit 1768014705
2 changed files with 7 additions and 1 deletions

View file

@ -293,7 +293,7 @@ def build_schedule_item(name, **kwargs):
schedule[name]['splay'] = kwargs['splay']
for item in ['range', 'when', 'once', 'once_fmt', 'cron', 'returner',
'return_config']:
'return_config', 'enabled']:
if item in kwargs:
schedule[name][item] = kwargs[item]

View file

@ -185,6 +185,12 @@ def present(name,
ret['comment'] = new_item['comment']
return ret
# The schedule.list gives us an item that is guaranteed to have an
# 'enabled' argument. Before comparing, add 'enabled' if it's not
# available (assume True, like schedule.list does)
if 'enabled' not in new_item:
new_item['enabled'] = True
if new_item == current_schedule[name]:
ret['comment'].append('Job {0} in correct state'.format(name))
else: