mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Set python_shell=False for cron.py
This commit is contained in:
parent
3475acaaa9
commit
1b239e5df7
@ -157,7 +157,8 @@ def write_cron_file(user, path):
|
||||
|
||||
salt '*' cron.write_cron_file root /tmp/new_cron
|
||||
'''
|
||||
return __salt__['cmd.retcode'](_get_cron_cmdstr(user, path)) == 0
|
||||
return __salt__['cmd.retcode'](_get_cron_cmdstr(user, path),
|
||||
python_shell=False) == 0
|
||||
|
||||
|
||||
def write_cron_file_verbose(user, path):
|
||||
@ -170,7 +171,8 @@ def write_cron_file_verbose(user, path):
|
||||
|
||||
salt '*' cron.write_cron_file_verbose root /tmp/new_cron
|
||||
'''
|
||||
return __salt__['cmd.run_all'](_get_cron_cmdstr(user, path))
|
||||
return __salt__['cmd.run_all'](_get_cron_cmdstr(user, path),
|
||||
python_shell=False)
|
||||
|
||||
|
||||
def _write_cron_lines(user, lines):
|
||||
@ -181,8 +183,10 @@ def _write_cron_lines(user, lines):
|
||||
with salt.utils.fopen(path, 'w+') as fp_:
|
||||
fp_.writelines(lines)
|
||||
if __grains__.get('os_family') in ('Solaris', 'AIX') and user != "root":
|
||||
__salt__['cmd.run']('chown {0} {1}'.format(user, path))
|
||||
ret = __salt__['cmd.run_all'](_get_cron_cmdstr(user, path))
|
||||
__salt__['cmd.run']('chown {0} {1}'.format(user, path),
|
||||
python_shell=False)
|
||||
ret = __salt__['cmd.run_all'](_get_cron_cmdstr(user, path),
|
||||
python_shell=False)
|
||||
os.remove(path)
|
||||
return ret
|
||||
|
||||
@ -211,7 +215,9 @@ def raw_cron(user):
|
||||
cmd = 'crontab -l {0}'.format(user)
|
||||
else:
|
||||
cmd = 'crontab -l -u {0}'.format(user)
|
||||
lines = __salt__['cmd.run_stdout'](cmd, rstrip=False).splitlines()
|
||||
lines = __salt__['cmd.run_stdout'](cmd,
|
||||
rstrip=False,
|
||||
python_shell=False).splitlines()
|
||||
if len(lines) != 0 and lines[0].startswith('# DO NOT EDIT THIS FILE - edit the master and reinstall.'):
|
||||
del lines[0:3]
|
||||
return '\n'.join(lines)
|
||||
|
Loading…
Reference in New Issue
Block a user