only write cron file if it is changed

Fixes #27215.
This commit is contained in:
Justin Findlay 2015-09-18 10:41:38 -06:00
parent 59a07cae68
commit 1e335297e2

View file

@ -524,13 +524,13 @@ def file(name,
return ret
if ret['changes']:
cron_ret = __salt__['cron.write_cron_file_verbose'](user, cron_path)
ret['changes'] = {'diff': ret['changes']['diff']}
ret['comment'] = 'Crontab for user {0} was updated'.format(user)
elif ret['result']:
ret['comment'] = 'Crontab for user {0} is in the correct ' \
'state'.format(user)
cron_ret = __salt__['cron.write_cron_file_verbose'](user, cron_path)
if cron_ret['retcode']:
ret['comment'] = 'Unable to update user {0} crontab {1}.' \
' Error: {2}'.format(user, cron_path, cron_ret['stderr'])