From a966662e9a9a8fd28832b2bc5a7d0d0df15b113d Mon Sep 17 00:00:00 2001 From: Sven Wegener Date: Fri, 22 Feb 2019 10:25:23 +0100 Subject: [PATCH] crypttab: Trim trailing newlines (#51594) Having a comment or an empty line in /etc/crypttab results in an additional empty line being added, because the newline that is part of the line being read is getting re-injected in addition to the newline used to concatenate the lines. Signed-off-by: Sven Wegener --- lib/ansible/modules/system/crypttab.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ansible/modules/system/crypttab.py b/lib/ansible/modules/system/crypttab.py index d976dbdc2d..2c3f9d22c7 100644 --- a/lib/ansible/modules/system/crypttab.py +++ b/lib/ansible/modules/system/crypttab.py @@ -218,6 +218,7 @@ class Line(object): self.opts = Options(opts) if line is not None: + self.line = self.line.rstrip('\n') if self._line_valid(line): self.name, backing_device, password, opts = self._split_line(line)