mirror of
https://github.com/thegeeklab/ansible-doctor.git
synced 2024-11-23 05:10:41 +00:00
Rename vars to defaults
This commit is contained in:
parent
9c77a76567
commit
ac6d161a6d
@ -26,11 +26,11 @@ class Parser:
|
||||
self.log = structlog.get_logger()
|
||||
self._files_registry = Registry()
|
||||
self._parse_meta_file()
|
||||
self._parse_var_files()
|
||||
self._parse_defaults_files()
|
||||
self._parse_task_tags()
|
||||
self._populate_doc_data()
|
||||
|
||||
def _parse_var_files(self):
|
||||
def _parse_defaults_files(self):
|
||||
for rfile in self._files_registry.get_files():
|
||||
if any(fnmatch.fnmatch(rfile, "*/defaults/*." + ext) for ext in YAML_EXTENSIONS):
|
||||
with open(rfile, encoding="utf8") as yamlfile:
|
||||
@ -42,7 +42,7 @@ class Parser:
|
||||
data = defaultdict(dict, raw or {})
|
||||
|
||||
for key, value in data.items():
|
||||
self._data["var"][key] = {"value": {key: value}}
|
||||
self._data["defaults"][key] = {"value": {key: value}}
|
||||
|
||||
def _parse_meta_file(self):
|
||||
self._data["meta"]["name"] = {"value": self.config.config["role_name"]}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% set var = role.var | default({}) %}
|
||||
{% set var = role.defaults | default({}) %}
|
||||
{% if var %}
|
||||
## Default Variables
|
||||
{% for key, item in var | dictsort %}
|
@ -1,8 +1,8 @@
|
||||
- [Requirements](#requirements)
|
||||
{% set var = role.var | default({}) %}
|
||||
{% set var = role.defaults | default({}) %}
|
||||
{% if var %}
|
||||
- [Default Variables](#default-variables)
|
||||
{% if not options.tabulate_vars %}
|
||||
{% if not options.tabulate_defaults %}
|
||||
{% for key, item in var | dictsort %}
|
||||
- [{{ key }}](#{{ key }})
|
||||
{% endfor %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% set var = role.var | default({}) %}
|
||||
{% set var = role.defaults | default({}) %}
|
||||
{% if var %}
|
||||
## Default Variables
|
||||
|
@ -22,11 +22,11 @@ summary: {{ meta.summary.value | safe_join(" ") }}
|
||||
{# Requirements #}
|
||||
{% include '_requirements.j2' %}
|
||||
|
||||
{# Vars #}
|
||||
{% if options.tabulate_vars %}
|
||||
{% include '_vars_tabulated.j2' %}
|
||||
{# Defaults #}
|
||||
{% if options.tabulate_defaults %}
|
||||
{% include '_defaults_tabulated.j2' %}
|
||||
{% else %}
|
||||
{% include '_vars.j2' %}
|
||||
{% include '_defaults.j2' %}
|
||||
{% endif %}
|
||||
|
||||
{# Tag #}
|
||||
|
@ -14,11 +14,11 @@
|
||||
{# Requirements #}
|
||||
{% include '_requirements.j2' %}
|
||||
|
||||
{# Vars #}
|
||||
{% if options.tabulate_vars %}
|
||||
{% include '_vars_tabulated.j2' %}
|
||||
{# Defaults #}
|
||||
{% if options.tabulate_defaults %}
|
||||
{% include '_defaults_tabulated.j2' %}
|
||||
{% else %}
|
||||
{% include '_vars.j2' %}
|
||||
{% include '_defaults.j2' %}
|
||||
{% endif %}
|
||||
|
||||
{# Tag #}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% set var = role.var | default({}) %}
|
||||
{% set var = role.defaults | default({}) %}
|
||||
{% if var %}
|
||||
## Default Variables
|
||||
{% for key, item in var | dictsort %}
|
@ -1,10 +1,10 @@
|
||||
## Table of content
|
||||
|
||||
- [Requirements](#requirements)
|
||||
{% set var = role.var | default({}) %}
|
||||
{% set var = role.defaults | default({}) %}
|
||||
{% if var %}
|
||||
- [Default Variables](#default-variables)
|
||||
{% if not options.tabulate_vars %}
|
||||
{% if not options.tabulate_defaults %}
|
||||
{% for key, item in var | dictsort %}
|
||||
- [{{ key }}](#{{ key }})
|
||||
{% endfor %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% set var = role.var | default({}) %}
|
||||
{% set var = role.defaults | default({}) %}
|
||||
{% if var %}
|
||||
## Default Variables
|
||||
|
@ -82,7 +82,7 @@ template:
|
||||
# Configures whether to tabulate variables in the output. When set to `True`,
|
||||
# variables will be displayed in a tabular format intsead of plain marktdown sections.
|
||||
# NOTE: This option does not support rendering multiline code blocks.
|
||||
tabulate_vars: False
|
||||
tabulate_defaults: False
|
||||
|
||||
renderer:
|
||||
# By default, double spaces, spaces before and after line breaks or tab characters, etc.
|
||||
@ -145,7 +145,7 @@ ANSIBLE_DOCTOR_LOGGING__JSON=False
|
||||
|
||||
ANSIBLE_DOCTOR_TEMPLATE__NAME=readme
|
||||
ANSIBLE_DOCTOR_TEMPLATE__SRC=
|
||||
ANSIBLE_DOCTOR_TEMPLATE__OPTIONS__TABULATE_VARS=False
|
||||
ANSIBLE_DOCTOR_TEMPLATE__OPTIONS__TABULATE_DEFAULTS=False
|
||||
|
||||
ANSIBLE_DOCTOR_RENDERER__AUTOTRIM=True
|
||||
ANSIBLE_DOCTOR_RENDERER__INCLUDE_HEADER=
|
||||
|
Loading…
Reference in New Issue
Block a user