Repository: ansible/ansible

Issue:
TypeError: coercing to Unicode: need string or buffer, NoneType found
remote: Counting objects: 156, done.
remote: Compressing objects: 100% (79/79), done.
remote: Total 156 (delta 72), reused 43 (delta 43), pack-reused 24
Receiving objects: 100% (156/156), 145.20 KiB | 0 bytes/s, done.
Resolving deltas: 100% (72/72), completed with 36 local objects.
From github.com:ansible/ansible
   29347ac..527ae36  devel      -> origin/devel
   2714080..6dfa93b  stable-1.9 -> origin/stable-1.9
- [new branch]      synchronize-fix -> origin/synchronize-fix
  First, rewinding head to replay your work on top of it...
  Fast-forwarded devel to 527ae360b041c3777f9b2d0f82fe6463028c7b5b.

$ ansible --version
Traceback (most recent call last):
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/bin/ansible", line 40, in <module>
    from ansible.utils.display import Display
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/utils/display.py", line 32, in <module>
    from ansible import constants as C
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/constants.py", line 103, in <module>
    p, CONFIG_FILE = load_config_file()
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/constants.py", line 81, in load_config_file
    if os.path.isdir(path0):
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/lib/python2.7/genericpath.py", line 41, in isdir
    st = os.stat(s)
TypeError: coercing to Unicode: need string or buffer, NoneType found

TypeError: coercing to Unicode: need string or buffer, NoneType found
remote: Counting objects: 156, done.
remote: Compressing objects: 100% (79/79), done.
remote: Total 156 (delta 72), reused 43 (delta 43), pack-reused 24
Receiving objects: 100% (156/156), 145.20 KiB | 0 bytes/s, done.
Resolving deltas: 100% (72/72), completed with 36 local objects.
From github.com:ansible/ansible
   29347ac..527ae36  devel      -> origin/devel
   2714080..6dfa93b  stable-1.9 -> origin/stable-1.9
- [new branch]      synchronize-fix -> origin/synchronize-fix
  First, rewinding head to replay your work on top of it...
  Fast-forwarded devel to 527ae360b041c3777f9b2d0f82fe6463028c7b5b.

$ ansible --version
Traceback (most recent call last):
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/bin/ansible", line 40, in <module>
    from ansible.utils.display import Display
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/utils/display.py", line 32, in <module>
    from ansible import constants as C
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/constants.py", line 103, in <module>
    p, CONFIG_FILE = load_config_file()
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/constants.py", line 81, in load_config_file
    if os.path.isdir(path0):
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/lib/python2.7/genericpath.py", line 41, in isdir
    st = os.stat(s)
TypeError: coercing to Unicode: need string or buffer, NoneType found



Discussion:

Resolving patch:
diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py
--- a/lib/ansible/constants.py
+++ b/lib/ansible/constants.py
@@ -78,8 +78,8 @@ def load_config_file():
     path0 = os.getenv("ANSIBLE_CONFIG", None)
     if path0 is not None:
         path0 = os.path.expanduser(path0)
-    if os.path.isdir(path0):
-        path0 += "/ansible.cfg"
+        if os.path.isdir(path0):
+            path0 += "/ansible.cfg"
     path1 = os.getcwd() + "/ansible.cfg"
     path2 = os.path.expanduser("~/.ansible.cfg")
     path3 = "/etc/ansible/ansible.cfg"


Test patch: