@ -31,6 +31,7 @@ import sys
import warnings
import warnings
from collections import defaultdict
from collections import defaultdict
from distutils . version import LooseVersion
from distutils . version import LooseVersion
from functools import partial
from pprint import PrettyPrinter
from pprint import PrettyPrinter
try :
try :
@ -49,6 +50,7 @@ from six import iteritems, string_types
from ansible . errors import AnsibleError
from ansible . errors import AnsibleError
from ansible . module_utils . _text import to_bytes , to_text
from ansible . module_utils . _text import to_bytes , to_text
from ansible . module_utils . common . collections import is_sequence
from ansible . plugins . loader import fragment_loader
from ansible . plugins . loader import fragment_loader
from ansible . utils import plugin_docs
from ansible . utils import plugin_docs
from ansible . utils . display import Display
from ansible . utils . display import Display
@ -154,6 +156,9 @@ def rst_xline(width, char="="):
return char * width
return char * width
test_list = partial ( is_sequence , include_strings = False )
def write_data ( text , output_dir , outputname , module = None ) :
def write_data ( text , output_dir , outputname , module = None ) :
''' dumps module output to a file or the screen, as requested '''
''' dumps module output to a file or the screen, as requested '''
@ -334,6 +339,7 @@ def jinja2_environment(template_dir, typ, plugin_type):
env . filters [ ' html_ify ' ] = html_ify
env . filters [ ' html_ify ' ] = html_ify
env . filters [ ' fmt ' ] = rst_fmt
env . filters [ ' fmt ' ] = rst_fmt
env . filters [ ' xline ' ] = rst_xline
env . filters [ ' xline ' ] = rst_xline
env . tests [ ' list ' ] = test_list
templates [ ' plugin ' ] = env . get_template ( ' plugin.rst.j2 ' )
templates [ ' plugin ' ] = env . get_template ( ' plugin.rst.j2 ' )
if plugin_type == ' module ' :
if plugin_type == ' module ' :