mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Added error message when reboot and extra params are passed, and added better boolean parsing on reboot
This commit is contained in:
parent
fc4ac70342
commit
6a02e3d918
1 changed files with 6 additions and 2 deletions
|
@ -233,7 +233,7 @@ def main():
|
||||||
day=dict(default='*'),
|
day=dict(default='*'),
|
||||||
month=dict(default='*'),
|
month=dict(default='*'),
|
||||||
weekday=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']
|
day = module.params['day']
|
||||||
month = module.params['month']
|
month = module.params['month']
|
||||||
weekday = module.params['weekday']
|
weekday = module.params['weekday']
|
||||||
reboot = module.params['reboot']
|
reboot = module.boolean(module.params.get('reboot', False))
|
||||||
do_install = module.params['state'] == 'present'
|
do_install = module.params['state'] == 'present'
|
||||||
changed = False
|
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:
|
if reboot:
|
||||||
job = "@reboot %s" % (job)
|
job = "@reboot %s" % (job)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue