From cd6e01349e5f67ecb18b6cf8c8d27ff1d46bf5dc Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 15 Sep 2016 08:57:15 -0500 Subject: [PATCH] Ensure parent tempdir's existence (#17585) While doing evil things with action plugins, I hit a code path in which the mkdir here was failing due to lack of parent dir. Changing this to makedirs made everything happy. Now, I'd obviously like to understand why the parent dir exists in some places and not others - but I could not find anywhere that C.DEFAULT_LOCAL_TMP is ensured to be created. --- lib/ansible/executor/module_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/executor/module_common.py b/lib/ansible/executor/module_common.py index 86549ea0b7..28245be6e3 100644 --- a/lib/ansible/executor/module_common.py +++ b/lib/ansible/executor/module_common.py @@ -647,7 +647,7 @@ def _find_snippet_imports(module_name, module_data, module_path, module_args, ta if not os.path.exists(lookup_path): # Note -- if we have a global function to setup, that would # be a better place to run this - os.mkdir(lookup_path) + os.makedirs(lookup_path) display.debug('ANSIBALLZ: Writing module') with open(cached_module_filename + '-part', 'wb') as f: f.write(zipdata)