diff --git a/salt/modules/cron.py b/salt/modules/cron.py index ab8b0b2f8b..355ba40b50 100644 --- a/salt/modules/cron.py +++ b/salt/modules/cron.py @@ -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]