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 :)
This commit is contained in:
J. Javier Maestro 2016-06-10 06:30:06 -07:00 committed by Brian Coca
parent 10860c50bd
commit 828b73dd2d

View file

@ -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: