Merge pull request #4895 from nextus/cron

Fix: absent state removing whole cron.d file instead of specific job
This commit is contained in:
jctanner 2013-11-14 05:30:00 -08:00
commit 85a398c2b4

View file

@ -455,6 +455,9 @@ def main():
if job is None and do_install:
module.fail_json(msg="You must specify 'job' to install a new cron job")
if job and name is None and not do_install:
module.fail_json(msg="You must specify 'name' to remove a cron job")
if reboot:
if special_time:
module.fail_json(msg="reboot and special_time are mutually exclusive")
@ -466,7 +469,7 @@ def main():
(backuph, backup_file) = tempfile.mkstemp(prefix='crontab')
crontab.write(backup_file)
if crontab.cron_file and not do_install:
if crontab.cron_file and not name and not do_install:
changed = crontab.remove_job_file()
module.exit_json(changed=changed,cron_file=cron_file,state=state)