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
faed1b2d
Commit
faed1b2d
authored
Jun 16, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better error reporting when doc parsing fails
parent
b27d7620
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
30 deletions
+33
-30
lib/ansible/cli/doc.py
+33
-30
No files found.
lib/ansible/cli/doc.py
View file @
faed1b2d
...
@@ -81,43 +81,46 @@ class DocCLI(CLI):
...
@@ -81,43 +81,46 @@ class DocCLI(CLI):
text
=
''
text
=
''
for
module
in
self
.
args
:
for
module
in
self
.
args
:
filename
=
module_loader
.
find_plugin
(
module
)
try
:
if
filename
is
None
:
filename
=
module_loader
.
find_plugin
(
module
)
self
.
display
.
warning
(
"module
%
s not found in
%
s
\n
"
%
(
module
,
DocCLI
.
print_paths
(
module_loader
)))
if
filename
is
None
:
continue
self
.
display
.
warning
(
"module
%
s not found in
%
s
\n
"
%
(
module
,
DocCLI
.
print_paths
(
module_loader
)))
continue
if
any
(
filename
.
endswith
(
x
)
for
x
in
self
.
BLACKLIST_EXTS
):
if
any
(
filename
.
endswith
(
x
)
for
x
in
self
.
BLACKLIST_EXTS
):
continue
continue
try
:
try
:
doc
,
plainexamples
,
returndocs
=
module_docs
.
get_docstring
(
filename
)
doc
,
plainexamples
,
returndocs
=
module_docs
.
get_docstring
(
filename
)
except
:
except
:
self
.
display
.
vvv
(
traceback
.
print_exc
())
self
.
display
.
vvv
(
traceback
.
print_exc
())
self
.
display
.
error
(
"module
%
s has a documentation error formatting or is missing documentation
\n
To see exact traceback use -vvv"
%
module
)
self
.
display
.
error
(
"module
%
s has a documentation error formatting or is missing documentation
\n
To see exact traceback use -vvv"
%
module
)
continue
continue
if
doc
is
not
None
:
if
doc
is
not
None
:
all_keys
=
[]
all_keys
=
[]
for
(
k
,
v
)
in
doc
[
'options'
]
.
iteritems
():
for
(
k
,
v
)
in
doc
[
'options'
]
.
iteritems
():
all_keys
.
append
(
k
)
all_keys
.
append
(
k
)
all_keys
=
sorted
(
all_keys
)
all_keys
=
sorted
(
all_keys
)
doc
[
'option_keys'
]
=
all_keys
doc
[
'option_keys'
]
=
all_keys
doc
[
'filename'
]
=
filename
doc
[
'filename'
]
=
filename
doc
[
'docuri'
]
=
doc
[
'module'
]
.
replace
(
'_'
,
'-'
)
doc
[
'docuri'
]
=
doc
[
'module'
]
.
replace
(
'_'
,
'-'
)
doc
[
'now_date'
]
=
datetime
.
date
.
today
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
doc
[
'now_date'
]
=
datetime
.
date
.
today
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
doc
[
'plainexamples'
]
=
plainexamples
doc
[
'plainexamples'
]
=
plainexamples
doc
[
'returndocs'
]
=
returndocs
doc
[
'returndocs'
]
=
returndocs
if
self
.
options
.
show_snippet
:
if
self
.
options
.
show_snippet
:
text
+=
DocCLI
.
get_snippet_text
(
doc
)
text
+=
DocCLI
.
get_snippet_text
(
doc
)
else
:
text
+=
DocCLI
.
get_man_text
(
doc
)
else
:
else
:
text
+=
DocCLI
.
get_man_text
(
doc
)
# this typically means we couldn't even parse the docstring, not just that the YAML is busted,
else
:
# probably a quoting issue.
# this typically means we couldn't even parse the docstring, not just that the YAML is busted,
raise
AnsibleError
(
"Parsing produced an empty object."
)
# probably a quoting issue.
except
Exception
,
e
:
self
.
display
.
warning
(
"module
%
s missing documentation (or could not parse documentation)
\n
"
%
module
)
raise
AnsibleError
(
"module
%
s missing documentation (or could not parse documentation):
%
s
\n
"
%
(
module
,
str
(
e
))
)
CLI
.
pager
(
text
)
CLI
.
pager
(
text
)
return
0
return
0
...
...
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