mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ported module_docs to use display
This commit is contained in:
parent
2b28cdc0dd
commit
2ac931d6c9
1 changed files with 10 additions and 4 deletions
|
@ -26,6 +26,12 @@ import traceback
|
||||||
from collections import MutableMapping, MutableSet, MutableSequence
|
from collections import MutableMapping, MutableSet, MutableSequence
|
||||||
from ansible.plugins import fragment_loader
|
from ansible.plugins import fragment_loader
|
||||||
|
|
||||||
|
try:
|
||||||
|
from __main__ import display
|
||||||
|
except ImportError:
|
||||||
|
from ansible.utils.display import Display
|
||||||
|
display = Display()
|
||||||
|
|
||||||
# modules that are ok that they do not have documentation strings
|
# modules that are ok that they do not have documentation strings
|
||||||
BLACKLIST_MODULES = [
|
BLACKLIST_MODULES = [
|
||||||
'async_wrapper', 'accelerate', 'async_status'
|
'async_wrapper', 'accelerate', 'async_status'
|
||||||
|
@ -56,7 +62,8 @@ def get_docstring(filename, verbose=False):
|
||||||
try:
|
try:
|
||||||
theid = t.id
|
theid = t.id
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
continue #TODO: should log these to figure out why this happens
|
# skip errors can happen when trying to use the normal code
|
||||||
|
continue
|
||||||
|
|
||||||
if 'DOCUMENTATION' in theid:
|
if 'DOCUMENTATION' in theid:
|
||||||
doc = yaml.safe_load(child.value.s)
|
doc = yaml.safe_load(child.value.s)
|
||||||
|
@ -110,9 +117,8 @@ def get_docstring(filename, verbose=False):
|
||||||
elif 'RETURN' in theid:
|
elif 'RETURN' in theid:
|
||||||
returndocs = child.value.s[1:]
|
returndocs = child.value.s[1:]
|
||||||
except:
|
except:
|
||||||
traceback.print_exc() # temp
|
display.error("unable to parse %s" % filename)
|
||||||
if verbose == True:
|
if verbose == True:
|
||||||
traceback.print_exc()
|
raise
|
||||||
print "unable to parse %s" % filename
|
|
||||||
return doc, plainexamples, returndocs
|
return doc, plainexamples, returndocs
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue