From 80c1765653ceed075327c1cf5db69c1dc91e42ba Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Tue, 6 Jun 2017 07:59:50 -0700 Subject: [PATCH] When cleaning up the AnsiBallZ tempdir we need to not fail if the tempdir wasn't created If the temp directory creation failed in mkdtemp then temp_path is never given a value. This would lead to a NameError exception which would obfuscate the original error (out of disk space being a common one). By catching NameError, python will raise the original exception as we want. Fixes #17215 --- 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 9e25b8446c..3714ae5316 100644 --- a/lib/ansible/executor/module_common.py +++ b/lib/ansible/executor/module_common.py @@ -345,7 +345,7 @@ if __name__ == '__main__': finally: try: shutil.rmtree(temp_path) - except OSError: + except (NameError, OSError): # tempdir creation probably failed pass sys.exit(exitcode)