From f787be359773cb57f0c3b40bc4e2c0256d06f32c Mon Sep 17 00:00:00 2001 From: Reid Wahl Date: Sat, 26 Aug 2017 18:47:58 -0500 Subject: [PATCH] Fixes #22335: Adds filename extension to tempfile for Vault --- lib/ansible/parsing/vault/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/parsing/vault/__init__.py b/lib/ansible/parsing/vault/__init__.py index 05f50bf1ed3..e02587e63de 100644 --- a/lib/ansible/parsing/vault/__init__.py +++ b/lib/ansible/parsing/vault/__init__.py @@ -662,7 +662,8 @@ class VaultEditor: existing_data=None, force_save=False, vault_id=None): # Create a tempfile - fd, tmp_path = tempfile.mkstemp() + root, ext = os.path.splitext(os.path.realpath(filename)) + fd, tmp_path = tempfile.mkstemp(suffix=ext) os.close(fd) try: