ansible/ansible — pull request #3328 by dirtyharrycallahan (2013-06-24 02:04:53+00:00)
Title: cron: do not permit empty job and allow all special times

This work started when I wanted to modify cron to strip suse headers from the installed crontab. Repeatedly calling crontab -l leads to the header being include each time an updated crontab is installed. Red Hat based distros do not add a header but SuSE based distros add it. The header looks like this ...

patrickc@linux-sngq:~/Projects/ansible/library/system> crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/tmp391ZP2 installed on Sun Jun 23 15:51:50 2013)
# (Cronie version 4.2)
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/tmp7AFA11 installed on Sun Jun 23 15:51:49 2013)
# (Cronie version 4.2)
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/tmpNw0r7e installed on Sun Jun 23 15:51:48 2013)
# (Cronie version 4.2)
#Ansible: check dirs every minute
* * * * * ls -alh > /dev/null

Wrote a couple of dozen units test and found some other problems. I have addressed some here and will address the other next week. So

TODO:
(1) strip the SuSE headers
(2) cron can leak tmp files to the /tmp directory.

Following problems addressed with this commit:
(1) Documentation indicated that if 'reboot' was supplied time
would be ignored. This is misleading because reboot and
date time fields are mutually exclusive. Updated the documentation.
(2) It was possible to create a crontab entry with a job of 'none'
(3) Minor readability edits.

Following enhancement
(1) Allow all special times such as yearly, monthly, daily, weekly, ...
while retaining reboot. Marked 'reboot' as deprecated.