summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2013-04-16 18:16:12 +0000
committerSeth Vidal <skvidal@fedoraproject.org>2013-04-16 18:16:12 +0000
commit129508a04844a6352a8cf56d6244029825353e8c (patch)
treebb3e17cc4b9e11245f3ed435a6570784e7e63e9c /library
parent93ab6e8e6f6db36e93cbb1f3c19a29591e23c49f (diff)
downloadansible-129508a04844a6352a8cf56d6244029825353e8c.zip
ansible-129508a04844a6352a8cf56d6244029825353e8c.tar.gz
ansible-129508a04844a6352a8cf56d6244029825353e8c.tar.xz
more fixes to unbreak the cron module
Diffstat (limited to 'library')
-rwxr-xr-xlibrary/cron12
1 files changed, 9 insertions, 3 deletions
diff --git a/library/cron b/library/cron
index 2a71a2a..0f1cef7 100755
--- a/library/cron
+++ b/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()