Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
e32f4a05
Commit
e32f4a05
authored
Nov 09, 2012
by
Jan-Piet Mens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move get_docstring from module_formatter into ansible/utils
parent
2ff3fc6a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
31 deletions
+54
-31
hacking/module_formatter.py
+4
-29
lib/ansible/utils/module_docs.py
+50
-0
library/ec2
+0
-2
No files found.
hacking/module_formatter.py
View file @
e32f4a05
...
...
@@ -29,12 +29,9 @@ import optparse
import
time
import
datetime
import
subprocess
import
traceback
import
ansible.utils
from
ansible.utils
import
module_docs
# modules that are ok that they do not have documentation strings
BLACKLIST_MODULES
=
[
'async_wrapper'
]
# Get parent directory of the directory this script lives in
MODULEDIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
...
...
@@ -133,28 +130,6 @@ def rst_xline(width, char="="):
def
load_examples_section
(
text
):
return
text
.
split
(
'***BREAK***'
)
def
get_docstring
(
filename
,
verbose
=
False
):
"""
Search for assignment of the DOCUMENTATION variable in the given file.
Parse that from YAML and return the YAML doc or None.
"""
doc
=
None
try
:
# Thank you, Habbie, for this bit of code :-)
M
=
ast
.
parse
(
''
.
join
(
open
(
filename
)))
for
child
in
M
.
body
:
if
isinstance
(
child
,
ast
.
Assign
):
if
'DOCUMENTATION'
in
(
t
.
id
for
t
in
child
.
targets
):
doc
=
yaml
.
load
(
child
.
value
.
s
)
except
:
traceback
.
print_exc
()
print
"unable to parse
%
s"
%
filename
return
doc
def
return_data
(
text
,
options
,
outputname
,
module
):
if
options
.
output_dir
is
not
None
:
f
=
open
(
os
.
path
.
join
(
options
.
output_dir
,
outputname
%
module
),
'w'
)
...
...
@@ -326,9 +301,9 @@ def main():
js_data
.
append
(
j
)
continue
doc
=
get_docstring
(
fname
,
verbose
=
options
.
verbose
)
doc
=
ansible
.
utils
.
module_docs
.
get_docstring
(
fname
,
verbose
=
options
.
verbose
)
if
doc
is
None
and
module
not
in
BLACKLIST_MODULES
:
if
doc
is
None
and
module
not
in
ansible
.
utils
.
module_docs
.
BLACKLIST_MODULES
:
sys
.
stderr
.
write
(
"*** ERROR: CORE MODULE MISSING DOCUMENTATION:
%
s ***
\n
"
%
module
)
#sys.exit(1)
...
...
lib/ansible/utils/module_docs.py
0 → 100755
View file @
e32f4a05
#!/usr/bin/env python
# (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
import
os
import
sys
import
ast
import
yaml
import
traceback
# modules that are ok that they do not have documentation strings
BLACKLIST_MODULES
=
[
'async_wrapper'
,
]
def
get_docstring
(
filename
,
verbose
=
False
):
"""
Search for assignment of the DOCUMENTATION variable in the given file.
Parse that from YAML and return the YAML doc or None.
"""
doc
=
None
try
:
# Thank you, Habbie, for this bit of code :-)
M
=
ast
.
parse
(
''
.
join
(
open
(
filename
)))
for
child
in
M
.
body
:
if
isinstance
(
child
,
ast
.
Assign
):
if
'DOCUMENTATION'
in
(
t
.
id
for
t
in
child
.
targets
):
doc
=
yaml
.
load
(
child
.
value
.
s
)
except
:
traceback
.
print_exc
()
print
"unable to parse
%
s"
%
filename
return
doc
library/ec2
View file @
e32f4a05
...
...
@@ -86,10 +86,8 @@ options:
examples:
- code: "local_action: ec2 keypair=admin instance_type=m1.large image=emi-40603AD1 wait=true group=webserver"
description: "Examples from Ansible Playbooks"
- code:
requirements: [ "euca2ools" ]
author: Seth Vidal
'''
import
euca2ools.commands.euca.runinstances
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment