Commit a5607365 authored by amd's avatar amd
Browse files

Make sure each file has a trailing newline.

parent d4cbe2ca
......@@ -1083,6 +1083,8 @@ def check_crontab(crontab_file, log, whitelisted_users=None):
cron_line_factory = CronLineFactory()
with open(crontab_file, 'r') as crontab_f:
for line in crontab_f:
missing_newline = line[-1] != "\n"
line = line.strip()
line_no += 1
......@@ -1091,5 +1093,9 @@ def check_crontab(crontab_file, log, whitelisted_users=None):
log.Emit(line_no, line)
# are we missing a trailing newline?
if missing_newline:
log.Error('Cron will not process this file - missing trailing newline')
# Summarize the log messages if there were any.
return log.Summary()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment