From 828b73dd2dc277d1ac0c4925a66fa21e66aa175d Mon Sep 17 00:00:00 2001 From: "J. Javier Maestro" Date: Fri, 10 Jun 2016 06:30:06 -0700 Subject: [PATCH] Fix: create retry_files_save_path if it doesn't exist (#15659) * Fix: create retry_files_save_path if it doesn't exist Ansible documentation states that retry_files_save_path directory will be created if it does not already exist. It currently doesn't, so this patch fixes it :) * Use makedirs_safe to ensure thread-safe dir creation @bcoca suggested to use the makedirs_safe helper function :) --- lib/ansible/executor/playbook_executor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/executor/playbook_executor.py b/lib/ansible/executor/playbook_executor.py index 6f38e8e8bc..8e02441ba0 100644 --- a/lib/ansible/executor/playbook_executor.py +++ b/lib/ansible/executor/playbook_executor.py @@ -27,6 +27,7 @@ from ansible import constants as C from ansible.executor.task_queue_manager import TaskQueueManager from ansible.playbook import Playbook from ansible.template import Templar +from ansible.utils.path import makedirs_safe from ansible.utils.unicode import to_unicode try: @@ -257,6 +258,7 @@ class PlaybookExecutor: re-running on ONLY the failed hosts. This may duplicate some variable information in group_vars/host_vars but that is ok, and expected. ''' + makedirs_safe(os.path.dirname(retry_path)) try: with open(retry_path, 'w') as fd: