Skip to content

Commit

Permalink
Fix regression in cron module (ansible#58751)
Browse files Browse the repository at this point in the history
This reverts the changes to cron from ansible#28662

This fixes ansible#58493
  • Loading branch information
dagwieers committed Jul 5, 2019
1 parent 709fbcf commit 6164773
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/ansible/modules/system/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,6 @@ def main():
['reboot', 'special_time'],
['insertafter', 'insertbefore'],
],
required_by=dict(
cron_file=('user',),
),
required_if=(
('state', 'present', ('job',)),
),
)

name = module.params['name']
Expand Down Expand Up @@ -657,6 +651,13 @@ def main():
if (special_time or reboot) and get_platform() == 'SunOS':
module.fail_json(msg="Solaris does not support special_time=... or @reboot")

if cron_file and do_install:
if not user:
module.fail_json(msg="To use cron_file=... parameter you must specify user=... as well")

if job is None and do_install:
module.fail_json(msg="You must specify 'job' to install a new cron job or variable")

if (insertafter or insertbefore) and not env and do_install:
module.fail_json(msg="Insertafter and insertbefore parameters are valid only with env=yes")

Expand Down

0 comments on commit 6164773

Please sign in to comment.