mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-03-20 03:57:02 +08:00
more fixes to unbreak the cron module
This commit is contained in:
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()
|
||||
|
||||
Reference in New Issue
Block a user