Fixup ec2_facts docs parsing

This commit is contained in:
Michael DeHaan 2013-01-26 12:34:30 -05:00
parent 5e4d29565c
commit 36066d8664
3 changed files with 11 additions and 12 deletions

View file

@ -33,6 +33,7 @@ from ansible import errors
from ansible.utils import module_docs
import ansible.constants as C
from ansible.utils import version
import traceback
MODULEDIR = C.DEFAULT_MODULE_PATH
@ -162,7 +163,8 @@ def main():
desc = desc + '...'
print "%-20s %-60.60s" % (module, desc)
except:
sys.stderr.write("ERROR: module %s missing documentation\n" % module)
traceback.print_exc()
sys.stderr.write("ERROR: module %s has a documentation error formatting or is missing documentation\n" % module)
pass
sys.exit()
@ -184,10 +186,11 @@ def main():
try:
doc = module_docs.get_docstring(filename)
except:
sys.stderr.write("ERROR: module %s missing documentation\n" % module)
traceback.print_exc()
sys.stderr.write("ERROR: module %s has a documentation error formatting or is missing documentation\n" % module)
continue
if not doc is None:
if doc is not None:
all_keys = []
for (k,v) in doc['options'].iteritems():

View file

@ -43,7 +43,6 @@ def get_docstring(filename, verbose=False):
if isinstance(child, ast.Assign):
if 'DOCUMENTATION' in (t.id for t in child.targets):
doc = yaml.load(child.value.s)
except:
if verbose == True:
traceback.print_exc()

View file

@ -16,8 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
DOCUMENTATION = '''
DOCUMENTATION="""
---
module: ec2_facts
short_description: Gathers facts about remote hosts within ec2 (aws)
@ -29,12 +28,10 @@ description:
notes:
- Parameters to filter on ec2_facts may be added later.
examples:
- code: ansible all -m ec2_facts --tree /tmp/facts
description: Obtain facts from ec2 metatdata servers. You will need to
run an instance within ec2.
author: Silviu Dicu: silviudicu@gmail.com
'''
- code: ansible all -m ec2_facts
description: Obtain facts from ec2 metatdata servers. You will need to run an instance within ec2.
author: "Silviu Dicu <silviudicu@gmail.com>"
"""
import urllib2
import socket