Added warning for cron jobs containing line breaks (#19184)
Fixes ansible/ansible-modules-core#4312, moved from ansible/ansible-modules-core#4488
This commit is contained in:
parent
d2f34754b2
commit
589e8fd6bc
1 changed files with 6 additions and 0 deletions
|
@ -69,6 +69,7 @@ options:
|
||||||
job:
|
job:
|
||||||
description:
|
description:
|
||||||
- The command to execute or, if env is set, the value of environment variable.
|
- The command to execute or, if env is set, the value of environment variable.
|
||||||
|
The command should not contain line breaks.
|
||||||
Required if state=present.
|
Required if state=present.
|
||||||
required: false
|
required: false
|
||||||
aliases: ['value']
|
aliases: ['value']
|
||||||
|
@ -718,6 +719,11 @@ def main():
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
if do_install:
|
if do_install:
|
||||||
|
for char in ['\r', '\n']:
|
||||||
|
if char in job.strip('\r\n'):
|
||||||
|
warnings.append('Job should not contain line breaks')
|
||||||
|
break
|
||||||
|
|
||||||
job = crontab.get_cron_job(minute, hour, day, month, weekday, job, special_time, disabled)
|
job = crontab.get_cron_job(minute, hour, day, month, weekday, job, special_time, disabled)
|
||||||
old_job = crontab.find_job(name, job)
|
old_job = crontab.find_job(name, job)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue