Exemple #1
0
def yaml2rst_role_defaults(dir_path):
    """Generate documentation on the fly based on Ansible default variables"""
    yaml2rst.convert_file(
            dir_path + '/defaults/main.yml',
            dir_path + 'DEFAULTS.rst',
            strip_regex=r'\s*(:?\[{3}|\]{3})\d?$',
            yaml_strip_regex=r'^\s{66,67}#\s\]{3}\d?$',
    )
def yaml2rst_role_defaults(dir_path):
    """Generate documentation on the fly based on Ansible default variables"""
    yaml2rst.convert_file(
            dir_path + '/defaults/main.yml',
            dir_path + 'DEFAULTS.rst',
            strip_regex=r'\s*(:?\[{3}|\]{3})\d?$',
            yaml_strip_regex=r'^\s{66,67}#\s\]{3}\d?$',
    )
Exemple #3
0
def yaml2rst_role_defaults(dir_path):  # NOQA
    """Generate documentation on the fly based on Ansible default variables"""
    for element in os.listdir(dir_path):
        if os.path.isdir(dir_path + element) and element not in ['includes']:
            yaml2rst.convert_file(
                dir_path + element + '/defaults/main.yml',
                dir_path + element + '/docs/defaults.rst',
                strip_regex=r'\s*(:?\[{3}|\]{3})\d?$',
                yaml_strip_regex=r'^\s{66,67}#\s\]{3}\d?$',
            )
Exemple #4
0
def yaml2rst_role_defaults(dir_path):  # NOQA
    """Generate documentation on the fly based on Ansible default variables"""
    for element in os.listdir(dir_path):
        if os.path.isdir(dir_path + element + '/defaults') and element not in ['includes']:
            yaml2rst.convert_file(
                dir_path + element + '/defaults/main.yml',
                dir_path + element + '/docs/defaults.rst',
                strip_regex=r'\s*(:?\[{3}|\]{3})\d?$',
                yaml_strip_regex=r'^\s{66,67}#\s\]{3}\d?$',
            )
Exemple #5
0
def yaml2rst_role_defaults(dir_path):
    """Generate documentation on the fly based on Ansible default variables"""
    yaml2rst.convert_file(dir_path + '/defaults/main.yml',
                          dir_path + 'DEFAULTS.rst')
Exemple #6
0
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os

# Generate documentation on the fly based on Ansible default variables
import yaml2rst

try:
  for element in os.listdir('ansible/roles'):
    if os.path.isdir('ansible/roles/' + element):
      yaml2rst.convert_file('ansible/roles/' + element + '/defaults/main.yml', 'ansible/roles/' + element + '/docs/defaults.rst')
except:
  pass

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Exemple #7
0
import sphinx_rtd_theme
import sys
import os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('_lib'))

# Generate documentation on the fly based on Ansible default variables
import yaml2rst

# Convert comments from Ansible defaults to rst page
yaml2rst.convert_file(
    '../defaults/main.yml',
    'defaults.rst',
    strip_regex=r'\s*(:?\[{3}|\]{3})\d?$',
    yaml_strip_regex=r'^\s{66,67}#\s\]{3}\d?$',
)


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx_rtd_theme']

# Add any paths that contain templates here, relative to this directory.
Exemple #8
0
            for filename in files:
                if not filename.startswith('.'):
                    defaults_file = os.path.join(path, filename)
                    defaults_dir = os.path.dirname(defaults_file).lstrip('../')

                    if not os.path.isdir(defaults_dir):
                        try:
                            os.makedirs(defaults_dir)
                        except OSError:
                            print("Creation of the directory %s failed"
                                  % defaults_dir)

                    yaml2rst.convert_file(
                        defaults_file,
                        (os.path.splitext(defaults_file)[0]
                            + '.rst').lstrip('../'),
                        strip_regex=r'\s*(:?\[{3}|\]{3})\d?$',
                        yaml_strip_regex=r'^\s{66,67}#\s\]{3}\d?$',
                    )


# Ignore warnings about non-local images
def _warn_node(self, msg, node, **kwargs):
    if not msg.startswith('nonlocal image URI found:'):
        self._warnfunc(msg, '%s:%s' % get_source_line(node))


sphinx.environment.BuildEnvironment.warn_node = _warn_node

git_commit_id = os.popen('git rev-parse --short HEAD').read().strip()
Exemple #9
0
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os

# Generate documentation on the fly based on Ansible default variables
import yaml2rst

try:
    for element in os.listdir("ansible/roles"):
        if os.path.isdir("ansible/roles/" + element):
            yaml2rst.convert_file(
                "ansible/roles/" + element + "/defaults/main.yml", "ansible/roles/" + element + "/docs/defaults.rst"
            )
except:
    pass

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
Exemple #10
0
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

# Generate documentation on the fly based on Ansible default variables
import yaml2rst

for element in os.listdir('ansible/roles'):
    if os.path.isdir('ansible/roles/' + element):
        yaml2rst.convert_file(
            'ansible/roles/' + element + '/defaults/main.yml',
            'ansible/roles/' + element + '/docs/defaults.rst',
            strip_regex=r'\s*(:?\[{3}|\]{3})\d?$',
            yaml_strip_regex=r'^\s{66,67}#\s\]{3}\d?$',
        )

from subprocess import call
call(['bin/sphinx_conf_pre_hook'])

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = 'default'

if not on_rtd:  # only import and set the theme if we're building docs locally
    import sphinx_rtd_theme
    html_theme = 'sphinx_rtd_theme'
    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
Exemple #11
0
# -*- coding: utf-8 -*-

import sys
import os

# Generate documentation on the fly based on Ansible default variables
import yaml2rst

os.path.isfile("../defaults/main,yml") and yaml2rst.convert_file("../defaults/main.yml", "defaults.rst")

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = ".rst"
Exemple #12
0
Fichier : conf.py Projet : ser/docs
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os

# Generate documentation on the fly based on Ansible default variables
import yaml2rst

for element in os.listdir('ansible/roles'):
  if os.path.isdir('ansible/roles/' + element):
    yaml2rst.convert_file(
      'ansible/roles/' + element + '/defaults/main.yml',
      'ansible/roles/' + element + '/docs/defaults.rst',
      strip_regex=r'\s*(:?\[{3}|\]{3})\d?$',
      yaml_strip_regex=r'^\s{66,67}#\s\]{3}\d?$',
    )

from subprocess import call
call(['bin/sphinx_conf_pre_hook'])

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))

# -- General configuration ------------------------------------------------

suppress_warnings = ['image.nonlocal_uri']
Exemple #13
0
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os

# Generate documentation on the fly based on Ansible default variables
import yaml2rst

try:
  for element in os.listdir('ansible/roles'):
    if os.path.isdir('ansible/roles/' + element):
      yaml2rst.convert_file('ansible/roles/' + element + '/defaults/main.yml', 'ansible/roles/' + element + '/docs/defaults.rst')
except:
  pass

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Exemple #14
0
def yaml2rst_role_defaults(dir_path):
    """Generate documentation on the fly based on Ansible default variables"""
    yaml2rst.convert_file(
            dir_path + '/defaults/main.yml',
            dir_path + 'DEFAULTS.rst'
    )
Exemple #15
0
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os

on_rtd = os.environ.get("READTHEDOCS", None) == "True"

# Generate documentation on the fly based on Ansible default variables
import yaml2rst

for element in os.listdir("ansible/roles"):
    if os.path.isdir("ansible/roles/" + element):
        yaml2rst.convert_file(
            "ansible/roles/" + element + "/defaults/main.yml",
            "ansible/roles/" + element + "/docs/defaults.rst",
            strip_regex=r"\s*(:?\[{3}|\]{3})\d?$",
            yaml_strip_regex=r"^\s{66,67}#\s\]{3}\d?$",
        )

from subprocess import call

call(["bin/sphinx_conf_pre_hook"])


# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = "default"

if not on_rtd:  # only import and set the theme if we're building docs locally
    import sphinx_rtd_theme