From 6a02e3d91840f95314821cdd72b2162e67969f2c Mon Sep 17 00:00:00 2001 From: Chelsea Robb Date: Wed, 19 Dec 2012 13:11:58 +1100 Subject: [PATCH] Added error message when reboot and extra params are passed, and added better boolean parsing on reboot --- library/cron | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/cron b/library/cron index 04482cafa6..9bab53e017 100644 --- a/library/cron +++ b/library/cron @@ -233,7 +233,7 @@ def main(): day=dict(default='*'), month=dict(default='*'), weekday=dict(default='*'), - reboot=dict(required=False, default=False) + reboot=dict(required=False, default=False, choices=BOOLEANS) ) ) @@ -246,9 +246,13 @@ def main(): day = module.params['day'] month = module.params['month'] weekday = module.params['weekday'] - reboot = module.params['reboot'] + reboot = module.boolean(module.params.get('reboot', False)) do_install = module.params['state'] == 'present' changed = False + + if reboot and (len(set([minute, hour, day, month, weekday, '*'])) != 1): + module.fail_json(msg="You must specify either reboot=True or any of minute, hour, day, month, weekday") + if reboot: job = "@reboot %s" % (job) else: