From bcfab26d7836a13effad1fa766be4a7cf807f42d Mon Sep 17 00:00:00 2001 From: kubilus1 Date: Mon, 11 Apr 2016 01:55:07 -0400 Subject: [PATCH] Unchecked index causes IndexError. --- lib/ansible/modules/extras/system/crypttab.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/extras/system/crypttab.py b/lib/ansible/modules/extras/system/crypttab.py index d483e33963..842b5bc7d0 100755 --- a/lib/ansible/modules/extras/system/crypttab.py +++ b/lib/ansible/modules/extras/system/crypttab.py @@ -205,6 +205,8 @@ class Crypttab(object): for line in self._lines: lines.append(str(line)) crypttab = '\n'.join(lines) + if len(crypttab) == 0: + crypttab += '\n' if crypttab[-1] != '\n': crypttab += '\n' return crypttab