Fix cron module for python3

This commit is contained in:
ninja- 2017-03-05 14:27:44 +01:00
parent 5de563bb77
commit 99ef3647f6

View File

@ -17,7 +17,7 @@ import random
import salt.utils
import salt.utils.files
from salt.ext.six.moves import range
from salt.utils.locales import sdecode
TAG = '# Lines below here are managed by Salt, do not edit\n'
SALT_CRON_IDENTIFIER = 'SALT_CRON_IDENTIFIER'
@ -264,16 +264,16 @@ def raw_cron(user):
if _check_instance_uid_match(user) or __grains__.get('os_family') in ('Solaris', 'AIX'):
cmd = 'crontab -l'
# Preserve line endings
lines = __salt__['cmd.run_stdout'](cmd,
lines = sdecode(__salt__['cmd.run_stdout'](cmd,
runas=user,
rstrip=False,
python_shell=False).splitlines(True)
python_shell=False)).splitlines(True)
else:
cmd = 'crontab -u {0} -l'.format(user)
# Preserve line endings
lines = __salt__['cmd.run_stdout'](cmd,
lines = sdecode(__salt__['cmd.run_stdout'](cmd,
rstrip=False,
python_shell=False).splitlines(True)
python_shell=False)).splitlines(True)
if len(lines) != 0 and lines[0].startswith('# DO NOT EDIT THIS FILE - edit the master and reinstall.'):
del lines[0:3]