mount - add a newline at the end of line in fstab

* Fixes #210

Signed-off-by: Hideki Saito <saito@fgrep.org>
This commit is contained in:
Hideki Saito
2021-06-19 12:08:47 +09:00
parent 595ee76b69
commit 5a2b3662cb
3 changed files with 47 additions and 3 deletions

View File

@@ -254,6 +254,10 @@ def _set_mount_save_old(module, args):
'%(src)s - %(name)s %(fstype)s %(passno)s %(boot)s %(opts)s\n')
for line in open(args['fstab'], 'r').readlines():
# Append newline if the line in fstab does not finished with newline.
if not line.endswith('\n'):
line += '\n'
old_lines.append(line)
if not line.strip():