From 36066d8664077b77830ce8fcbc2a790950892b92 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 26 Jan 2013 12:34:30 -0500 Subject: [PATCH] Fixup ec2_facts docs parsing --- bin/ansible-doc | 9 ++++++--- lib/ansible/utils/module_docs.py | 1 - library/ec2_facts | 13 +++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/bin/ansible-doc b/bin/ansible-doc index 7648e441787..9e8878376c3 100755 --- a/bin/ansible-doc +++ b/bin/ansible-doc @@ -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(): diff --git a/lib/ansible/utils/module_docs.py b/lib/ansible/utils/module_docs.py index 014c5dbcfdf..221cb4ad4e7 100755 --- a/lib/ansible/utils/module_docs.py +++ b/lib/ansible/utils/module_docs.py @@ -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() diff --git a/library/ec2_facts b/library/ec2_facts index 40984f44c7d..ef1628fac87 100644 --- a/library/ec2_facts +++ b/library/ec2_facts @@ -16,8 +16,7 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . - -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 " +""" import urllib2 import socket