Skip to content

Commit

Permalink
Merge pull request ansible#4895 from nextus/cron
Browse files Browse the repository at this point in the history
Fix: absent state removing whole cron.d file instead of specific job
  • Loading branch information
jctanner committed Nov 14, 2013
2 parents 91e5569 + 17cbbcd commit 4707e3a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion library/system/cron
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)

Expand Down

0 comments on commit 4707e3a

Please sign in to comment.