From 9686695170bd1cec9866e39cdedc8c54f23e1d6b Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 21 Feb 2014 21:06:04 -0500 Subject: [PATCH] Assume empty files are unencrypted. --- lib/ansible/utils/vault.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/vault.py b/lib/ansible/utils/vault.py index 00f314af566..b25f19c155b 100644 --- a/lib/ansible/utils/vault.py +++ b/lib/ansible/utils/vault.py @@ -51,7 +51,11 @@ def is_encrypted(filename): # read first line of the file with open(filename) as f: - head = f.next() + try: + head = f.next() + except StopIteration: + # empty file, so not encrypted + return False if head.startswith(HEADER): return True