clean up how it puts the files in place - in f18 /tmp is tmpfs which

means ln and os.rename() won't work across fs.
pull/2698/head
Seth Vidal 12 years ago
parent 84fb92dac6
commit 5df2dadcdb

@ -132,6 +132,7 @@ updates: Mike Grozak
import re
import tempfile
import os
def get_jobs_file(module, user, tmpfile, cron_file):
if cron_file:
@ -143,11 +144,19 @@ def get_jobs_file(module, user, tmpfile, cron_file):
def install_jobs(module, user, tmpfile, cron_file):
if cron_file:
cmd = "ln -f %s /etc/cron.d/%s" % (tmpfile, cron_file)
cron_file = '/etc/cron.d/%s' % cron_file
try:
module.atomic_replace(tmpfile, cron_file)
except (OSError, IOError), e:
return (1, "", str(e))
except:
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…
Cancel
Save