From 02d9f14b8b470e910227fd56c83b869a5a0469f2 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 6 Sep 2016 04:46:47 +0200 Subject: [PATCH] Do not crash if current dir do not exist, fix #17369 (#17379) Do not crash if current dir do not exist --- lib/ansible/constants.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 04d2c5e9896..1adb31c808a 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -112,7 +112,10 @@ def load_config_file(): path0 = os.path.expanduser(path0) if os.path.isdir(path0): path0 += "/ansible.cfg" - path1 = os.getcwd() + "/ansible.cfg" + try: + path1 = os.getcwd() + "/ansible.cfg" + except OSError: + path1 = None path2 = os.path.expanduser("~/.ansible.cfg") path3 = "/etc/ansible/ansible.cfg"