mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Rendering of crontab should reflect actual newline termination, in diff mode
This commit is contained in:
parent
b416015634
commit
f64990df02
1 changed files with 3 additions and 3 deletions
|
@ -460,7 +460,7 @@ class CronTab(object):
|
||||||
|
|
||||||
self.lines = newlines
|
self.lines = newlines
|
||||||
|
|
||||||
def render(self):
|
def render(self, diff=None):
|
||||||
"""
|
"""
|
||||||
Render this crontab as it would be in the crontab.
|
Render this crontab as it would be in the crontab.
|
||||||
"""
|
"""
|
||||||
|
@ -469,7 +469,7 @@ class CronTab(object):
|
||||||
crons.append(cron)
|
crons.append(cron)
|
||||||
|
|
||||||
result = '\n'.join(crons)
|
result = '\n'.join(crons)
|
||||||
if result:
|
if result and not diff:
|
||||||
result = result.rstrip('\r\n') + '\n'
|
result = result.rstrip('\r\n') + '\n'
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ def main():
|
||||||
|
|
||||||
if module._diff:
|
if module._diff:
|
||||||
diff = dict()
|
diff = dict()
|
||||||
diff['before'] = crontab.render()
|
diff['before'] = crontab.render(diff=True)
|
||||||
if crontab.cron_file:
|
if crontab.cron_file:
|
||||||
diff['before_header'] = crontab.cron_file
|
diff['before_header'] = crontab.cron_file
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue