mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixup ec2_facts docs parsing
This commit is contained in:
parent
5e4d29565c
commit
36066d8664
3 changed files with 11 additions and 12 deletions
|
@ -33,6 +33,7 @@ from ansible import errors
|
||||||
from ansible.utils import module_docs
|
from ansible.utils import module_docs
|
||||||
import ansible.constants as C
|
import ansible.constants as C
|
||||||
from ansible.utils import version
|
from ansible.utils import version
|
||||||
|
import traceback
|
||||||
|
|
||||||
MODULEDIR = C.DEFAULT_MODULE_PATH
|
MODULEDIR = C.DEFAULT_MODULE_PATH
|
||||||
|
|
||||||
|
@ -162,7 +163,8 @@ def main():
|
||||||
desc = desc + '...'
|
desc = desc + '...'
|
||||||
print "%-20s %-60.60s" % (module, desc)
|
print "%-20s %-60.60s" % (module, desc)
|
||||||
except:
|
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
|
pass
|
||||||
|
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -184,10 +186,11 @@ def main():
|
||||||
try:
|
try:
|
||||||
doc = module_docs.get_docstring(filename)
|
doc = module_docs.get_docstring(filename)
|
||||||
except:
|
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
|
continue
|
||||||
|
|
||||||
if not doc is None:
|
if doc is not None:
|
||||||
|
|
||||||
all_keys = []
|
all_keys = []
|
||||||
for (k,v) in doc['options'].iteritems():
|
for (k,v) in doc['options'].iteritems():
|
||||||
|
|
|
@ -43,7 +43,6 @@ def get_docstring(filename, verbose=False):
|
||||||
if isinstance(child, ast.Assign):
|
if isinstance(child, ast.Assign):
|
||||||
if 'DOCUMENTATION' in (t.id for t in child.targets):
|
if 'DOCUMENTATION' in (t.id for t in child.targets):
|
||||||
doc = yaml.load(child.value.s)
|
doc = yaml.load(child.value.s)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
if verbose == True:
|
if verbose == True:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
DOCUMENTATION="""
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
---
|
||||||
module: ec2_facts
|
module: ec2_facts
|
||||||
short_description: Gathers facts about remote hosts within ec2 (aws)
|
short_description: Gathers facts about remote hosts within ec2 (aws)
|
||||||
|
@ -29,12 +28,10 @@ description:
|
||||||
notes:
|
notes:
|
||||||
- Parameters to filter on ec2_facts may be added later.
|
- Parameters to filter on ec2_facts may be added later.
|
||||||
examples:
|
examples:
|
||||||
- code: ansible all -m ec2_facts --tree /tmp/facts
|
- code: ansible all -m ec2_facts
|
||||||
description: Obtain facts from ec2 metatdata servers. You will need to
|
description: Obtain facts from ec2 metatdata servers. You will need to run an instance within ec2.
|
||||||
run an instance within ec2.
|
author: "Silviu Dicu <silviudicu@gmail.com>"
|
||||||
|
"""
|
||||||
author: Silviu Dicu: silviudicu@gmail.com
|
|
||||||
'''
|
|
||||||
|
|
||||||
import urllib2
|
import urllib2
|
||||||
import socket
|
import socket
|
||||||
|
|
Loading…
Reference in a new issue