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 :)
(cherry picked from commit 828b73dd2d
)
This commit is contained in:
parent
d65e2aec81
commit
9bb754c0a7
1 changed files with 2 additions and 0 deletions
|
@ -27,6 +27,7 @@ from ansible import constants as C
|
||||||
from ansible.executor.task_queue_manager import TaskQueueManager
|
from ansible.executor.task_queue_manager import TaskQueueManager
|
||||||
from ansible.playbook import Playbook
|
from ansible.playbook import Playbook
|
||||||
from ansible.template import Templar
|
from ansible.template import Templar
|
||||||
|
from ansible.utils.path import makedirs_safe
|
||||||
from ansible.utils.unicode import to_unicode
|
from ansible.utils.unicode import to_unicode
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -257,6 +258,7 @@ class PlaybookExecutor:
|
||||||
re-running on ONLY the failed hosts. This may duplicate some variable
|
re-running on ONLY the failed hosts. This may duplicate some variable
|
||||||
information in group_vars/host_vars but that is ok, and expected.
|
information in group_vars/host_vars but that is ok, and expected.
|
||||||
'''
|
'''
|
||||||
|
makedirs_safe(os.path.dirname(retry_path))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(retry_path, 'w') as fd:
|
with open(retry_path, 'w') as fd:
|
||||||
|
|
Loading…
Reference in a new issue