more fixes to unbreak the cron module
This commit is contained in:
parent
93ab6e8e6f
commit
129508a048
1 changed files with 9 additions and 3 deletions
12
library/cron
12
library/cron
|
@ -148,11 +148,17 @@ def install_jobs(module, user, tmpfile, cron_file):
|
|||
if cron_file:
|
||||
dest_tmp = "%s.%s.%s.tmp" % (cron_file,os.getpid(),time.time())
|
||||
shutil.copyfile(tmpfile, dest_tmp)
|
||||
module.atomic_replace(dest_tmp, cron_file)
|
||||
try:
|
||||
module.atomic_replace(dest_tmp, cron_file)
|
||||
except (OSError, IOError), e:
|
||||
return (1, "", str(e))
|
||||
else:
|
||||
return (0, "", "")
|
||||
|
||||
|
||||
else:
|
||||
cmd = "crontab %s %s" % (user, tmpfile)
|
||||
|
||||
return module.run_command(cmd)
|
||||
return module.run_command(cmd)
|
||||
|
||||
def get_jobs(tmpfile):
|
||||
lines = open(tmpfile).read().splitlines()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue