<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Can you help us out in labelling this by telling us what kind of ticket this this?  You can say “Bug Report”, “Feature Idea”, “Feature Pull Request”, “New Module Pull Request”, “Bugfix Pull Request”, “Documentation Report”, or “Docs Pull Request”.</p>
<h5 dir="auto">Ansible Version:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# ansible-doc --version
ansible-doc 1.8 (devel 7d9661a266) last updated 2014/09/30 10:46:06 (GMT -400)
  lib/ansible/modules/core: (detached HEAD db5668b84c) last updated 2014/09/29 11:27:31 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD 110250d344) last updated 2014/09/29 11:27:34 (GMT -400)
  configured module search path = None"><pre class="notranslate"><code class="notranslate"># ansible-doc --version
ansible-doc 1.8 (devel 7d9661a266) last updated 2014/09/30 10:46:06 (GMT -400)
  lib/ansible/modules/core: (detached HEAD db5668b84c) last updated 2014/09/29 11:27:31 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD 110250d344) last updated 2014/09/29 11:27:34 (GMT -400)
  configured module search path = None
</code></pre></div>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Mac OSX</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">The command <code class="notranslate">ansible-doc -l</code> emits tracebacks while scanning modules.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<ol dir="auto">
<li><code class="notranslate">. hacking/env-setup</code></li>
<li><code class="notranslate">ansible-doc -l</code></li>
</ol>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">No tracebacks on stderr</p>
<h5 dir="auto">Actual Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="﻿﻿# ansible-doc  -l 1&gt;/dev/null 2| pbcopy 
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py&quot;, line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File &quot;/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py&quot;, line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File &quot;&lt;unknown&gt;&quot;, line 1
    gitdir: ../../../../.git/modules/lib/ansible/modules/core
          ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/bin/ansible-doc&quot;, line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module .git has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py&quot;, line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File &quot;/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py&quot;, line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File &quot;&lt;unknown&gt;&quot;, line 2
    *.py[co]
    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/bin/ansible-doc&quot;, line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module .gitignore has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py&quot;, line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File &quot;/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py&quot;, line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File &quot;&lt;unknown&gt;&quot;, line 1
    Welcome To Ansible GitHub
             ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/bin/ansible-doc&quot;, line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module CONTRIBUTING.md has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py&quot;, line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File &quot;/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py&quot;, line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File &quot;&lt;unknown&gt;&quot;, line 1
    GNU GENERAL PUBLIC LICENSE
   ^
IndentationError: unexpected indent
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/bin/ansible-doc&quot;, line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module COPYING has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py&quot;, line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File &quot;/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py&quot;, line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File &quot;&lt;unknown&gt;&quot;, line 2
    ====================
     ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/bin/ansible-doc&quot;, line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module README.md has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/bin/ansible-doc&quot;, line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module __init__.py has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py&quot;, line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File &quot;/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py&quot;, line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
TypeError: compile() expected string without null bytes
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/bin/ansible-doc&quot;, line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module __init__.pyc has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File &quot;/Users/jlaska/Downloads/ansible.git/bin/ansible-doc&quot;, line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module async_wrapper.py has a documentation error formatting or is missing documentation"><pre class="notranslate"><code class="notranslate">﻿﻿# ansible-doc  -l 1&gt;/dev/null 2| pbcopy 
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py", line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "&lt;unknown&gt;", line 1
    gitdir: ../../../../.git/modules/lib/ansible/modules/core
          ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/bin/ansible-doc", line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module .git has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py", line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "&lt;unknown&gt;", line 2
    *.py[co]
    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/bin/ansible-doc", line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module .gitignore has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py", line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "&lt;unknown&gt;", line 1
    Welcome To Ansible GitHub
             ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/bin/ansible-doc", line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module CONTRIBUTING.md has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py", line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "&lt;unknown&gt;", line 1
    GNU GENERAL PUBLIC LICENSE
   ^
IndentationError: unexpected indent
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/bin/ansible-doc", line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module COPYING has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py", line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "&lt;unknown&gt;", line 2
    ====================
     ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/bin/ansible-doc", line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module README.md has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/bin/ansible-doc", line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module __init__.py has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/lib/ansible/utils/module_docs.py", line 50, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
TypeError: compile() expected string without null bytes
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/bin/ansible-doc", line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module __init__.pyc has a documentation error formatting or is missing documentation
Traceback (most recent call last):
  File "/Users/jlaska/Downloads/ansible.git/bin/ansible-doc", line 184, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
ERROR: module async_wrapper.py has a documentation error formatting or is missing documentation
</code></pre></div>
<h1 dir="auto">Problem:</h1>
<p dir="auto">If you add a custom module using git submodules, ansible-doc prints traceback.</p>
<h2 dir="auto">setup in ansible.cfg</h2>
<p dir="auto">we set up a path for custom modules:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[default]
library = /usr/share/ansible:library"><pre class="notranslate"><code class="notranslate">[default]
library = /usr/share/ansible:library
</code></pre></div>
<h2 dir="auto">custom modules added with submodules</h2>
<p dir="auto">we added a module named openvz using `git submodule add  library/openvz</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="library$ find
.
./openvz
./openvz/.git
./openvz/openvz"><pre class="notranslate"><code class="notranslate">library$ find
.
./openvz
./openvz/.git
./openvz/openvz
</code></pre></div>
<h2 dir="auto">content of .git</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ cat ./openvz/.git
 gitdir: ../../../.git/modules/playbooks/library/openvz"><pre class="notranslate"><code class="notranslate">$ cat ./openvz/.git
 gitdir: ../../../.git/modules/playbooks/library/openvz
</code></pre></div>
<h2 dir="auto">error in run command ansible-doc</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-doc -l 
Traceback (most recent call last):
  File &quot;/usr/local/lib/python2.7/dist-packages/ansible/utils/module_docs.py&quot;, line 44, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File &quot;/usr/lib/python2.7/ast.py&quot;, line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File &quot;&lt;unknown&gt;&quot;, line 1
    gitdir: ../../../.git/modules/playbooks/library/openvz
          ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File &quot;/usr/local/bin/ansible-doc&quot;, line 174, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
..."><pre class="notranslate"><code class="notranslate">$ ansible-doc -l 
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ansible/utils/module_docs.py", line 44, in get_docstring
    M = ast.parse(''.join(open(filename)))
  File "/usr/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "&lt;unknown&gt;", line 1
    gitdir: ../../../.git/modules/playbooks/library/openvz
          ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "/usr/local/bin/ansible-doc", line 174, in get_module_list_text
    desc = tty_ify(doc.get('short_description', '?'))
AttributeError: 'NoneType' object has no attribute 'get'
...
</code></pre></div>
<h2 dir="auto">ansible version</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 1.5"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 1.5
</code></pre></div>
<h1 dir="auto">Expected</h1>
<p dir="auto">ansible-doc should ignore "hidden" directories.</p>