Fix boolean input and string-type validation
This commit is contained in:
parent
981e89117a
commit
e691e07646
1 changed files with 15 additions and 10 deletions
25
docs/templates/plugin.rst.j2
vendored
25
docs/templates/plugin.rst.j2
vendored
|
@ -95,7 +95,7 @@ Parameters
|
||||||
<td>
|
<td>
|
||||||
<div class="outer-elbow-container">
|
<div class="outer-elbow-container">
|
||||||
{% for i in range(1, loop.depth) %}
|
{% for i in range(1, loop.depth) %}
|
||||||
<div class="elbow-placeholder"></div>
|
<div class="elbow-placeholder"/>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="elbow-key">
|
<div class="elbow-key">
|
||||||
<b>@{ key }@</b>
|
<b>@{ key }@</b>
|
||||||
|
@ -107,7 +107,7 @@ Parameters
|
||||||
{# default / choices #}
|
{# default / choices #}
|
||||||
<td>
|
<td>
|
||||||
<div class="cell-border">
|
<div class="cell-border">
|
||||||
{# Recalculate choices and boolean values #}
|
{# Turn boolean values in 'yes' and 'no' values #}
|
||||||
{% if value.default is defined %}
|
{% if value.default is defined %}
|
||||||
{% if value.default == true %}
|
{% if value.default == true %}
|
||||||
{% set _x = value.update({'default': 'yes'}) %}
|
{% set _x = value.update({'default': 'yes'}) %}
|
||||||
|
@ -122,10 +122,16 @@ Parameters
|
||||||
{% if value.choices %}
|
{% if value.choices %}
|
||||||
<ul><b>Choices:</b>
|
<ul><b>Choices:</b>
|
||||||
{% for choice in value.choices %}
|
{% for choice in value.choices %}
|
||||||
{% if (value.default is string and choice == value.default) or (value.default is iterable and choice in value.default) %}
|
{# Turn boolean values in 'yes' and 'no' values #}
|
||||||
<li type="disc"><div style="color: blue"><b>@{ choice | escape }@</b> ←</div></li>
|
{% if choice == true %}
|
||||||
|
{% set choice = 'yes' %}
|
||||||
|
{% elif choice == false %}
|
||||||
|
{% set choice = 'no' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if (value.default is string and value.default == choice) or (value.default is iterable and value.default is not string and choice in value.default) %}
|
||||||
|
<li><div style="color: blue"><b>@{ choice | escape }@</b> ←</div></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li type="circle">@{ choice | escape }@</li>
|
<li>@{ choice | escape }@</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -240,7 +246,7 @@ Facts returned by this module are added/updated in the ``hostvars`` host facts a
|
||||||
<td>
|
<td>
|
||||||
<div class="outer-elbow-container">
|
<div class="outer-elbow-container">
|
||||||
{% for i in range(1, loop.depth) %}
|
{% for i in range(1, loop.depth) %}
|
||||||
<div class="elbow-placeholder"></div>
|
<div class="elbow-placeholder"/>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="elbow-key">
|
<div class="elbow-key">
|
||||||
<b>@{ key }@</b>
|
<b>@{ key }@</b>
|
||||||
|
@ -304,8 +310,7 @@ Common return values are documented :ref:`here <common_return_values>`, the foll
|
||||||
<td>
|
<td>
|
||||||
<div class="outer-elbow-container">
|
<div class="outer-elbow-container">
|
||||||
{% for i in range(1, loop.depth) %}
|
{% for i in range(1, loop.depth) %}
|
||||||
<div class="elbow-placeholder">
|
<div class="elbow-placeholder"/>
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="elbow-key">
|
<div class="elbow-key">
|
||||||
<b>@{ key }@</b>
|
<b>@{ key }@</b>
|
||||||
|
@ -324,9 +329,9 @@ Common return values are documented :ref:`here <common_return_values>`, the foll
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br/>
|
<br/>
|
||||||
{% if value.sample is defined and value.sample %}
|
{% if value.sample is defined and value.sample %}
|
||||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||||
{# TODO: The sample should be escaped, using | escape or | htmlify, but both mess things up beyond repair with dicts #}
|
{# TODO: The sample should be escaped, using |escape or |htmlify, but both mess things up beyond repair with dicts #}
|
||||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">@{ value.sample | replace('\n', '\n ') | html_ify }@</div>
|
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">@{ value.sample | replace('\n', '\n ') | html_ify }@</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue