community.general/lib/ansible/plugins/action
Alex Tsitsimpis c3ab6cb9b1 template: Add option to lstrip_blocks' and fix settingtrim_blocks` inline (#37478)
* template: Add integration tests for `lstrip_blocks'

Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>

* template: Fix passing `trim_blocks' inline

Fix passing `trim_blocks' option to the template module as inline
argument. Previously passing the `trim_blocks' option inline instead of
using the YAML dictionary format resulted in it always being set to
`True', even if `trim_blocks=False' was used.

Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>

* template: Add option to `lstrip_blocks'

Add option to set `lstrip_blocks' when using the template module to
render Jinja templates. The Jinja documentation suggests that
`trim_blocks' and `lstrip_blocks' is a great combination and the
template module already provides an option for `trim_blocks'.

Note that although `trim_blocks' in Ansible is enabled by default since
version 2.4, in order to avoid breaking things keep `lstrip_blocks'
disabled by default. Maybe in a future version it could be enabled by
default.

This seems to address issue #10725 in a more appropriate way than the
suggested.

Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>

* template: Add integration tests for `trim_blocks'

Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>

* template: Check Jinja2 support for `lstrip_blocks'

Since the `lstrip_blocks' option was added in Jinja2 version 2.7, raise
an exception when `lstrip_blocks' is set but Jinja2 does not support it.
Check support for `lstrip_blocks' option by checking `jinja2.defaults'
for `LSTRIP_BLOCKS' and do not use `jinja2.__version__' because the
latter is set to `unknown' in some cases, perhaps due to bug in
`pkg_resources' in Python 2.6.6.

Also update option description to state that Jinja2 version >=2.7 is
required.

Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>
2018-03-23 12:05:21 -04:00
..
__init__.py Normalize usage of temp and tmp on tmp (#36221) 2018-02-15 09:01:02 -08:00
add_host.py add_host: check if name or hostname arg is provided 2018-02-12 15:24:45 -05:00
aireos.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
aireos_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
aruba.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
aruba_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
asa.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
asa_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
assemble.py Normalize usage of temp and tmp on tmp (#36221) 2018-02-15 09:01:02 -08:00
assert.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
aws_s3.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
bigip.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
ce.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
ce_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
ce_template.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
command.py Normalize usage of temp and tmp on tmp (#36221) 2018-02-15 09:01:02 -08:00
copy.py Normalize usage of temp and tmp on tmp (#36221) 2018-02-15 09:01:02 -08:00
debug.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
dellos6.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
dellos6_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
dellos9.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
dellos9_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
dellos10.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
dellos10_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
edgeos_config.py Fix edgeos_config: {backup: yes} (#37619) 2018-03-21 12:48:09 -04:00
enos.py Lenovo license update (#36840) 2018-03-06 18:02:46 +00:00
enos_config.py Lenovo license update (#36840) 2018-03-06 18:02:46 +00:00
eos.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
eos_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
fail.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
fetch.py fetch: set fail_on_missing: True as default as per docs (#36469) 2018-02-21 18:10:23 +10:00
fortios_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
group_by.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
include_vars.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
ios.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
ios_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
iosxr.py Raise error when trying to use older iosxr modules with netconf (#37423) 2018-03-15 12:49:35 -04:00
iosxr_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
ironware.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
ironware_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
junos.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
junos_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_banner.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_base.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_interface.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_l2_interface.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_l3_interface.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_linkagg.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_lldp.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_lldp_interface.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_logging.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_ping.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_static_route.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_system.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_user.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_vlan.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
net_vrf.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
netconf_config.py netconf_config: support new src attribute (new Action Plugin) (#24337) 2017-05-11 18:43:44 +05:30
normal.py Normalize usage of temp and tmp on tmp (#36221) 2018-02-15 09:01:02 -08:00
nxos.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
nxos_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
onyx_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
ops_config.py Collated PEP8 fixes (#25293) 2017-06-02 12:14:11 +01:00
package.py Normalize usage of temp and tmp on tmp (#36221) 2018-02-15 09:01:02 -08:00
patch.py Fix the script and patch plugins tempfile ownership 2018-02-19 13:07:58 -08:00
pause.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
raw.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
script.py Fix the script and patch plugins tempfile ownership 2018-02-19 13:07:58 -08:00
service.py Normalize usage of temp and tmp on tmp (#36221) 2018-02-15 09:01:02 -08:00
set_fact.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
set_stats.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
shell.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
sros.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
sros_config.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
synchronize.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
telnet.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
template.py template: Add option to lstrip_blocks' and fix settingtrim_blocks` inline (#37478) 2018-03-23 12:05:21 -04:00
unarchive.py Normalize usage of temp and tmp on tmp (#36221) 2018-02-15 09:01:02 -08:00
vyos.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
vyos_config.py Fix edgeos_config: {backup: yes} (#37619) 2018-03-21 12:48:09 -04:00
wait_for_connection.py Fix py3 issue in wait_for_connection (#37646) 2018-03-20 11:21:19 -05:00
win_copy.py Normalize usage of temp and tmp on tmp (#36221) 2018-02-15 09:01:02 -08:00
win_reboot.py First bit of fixing temporary to have one source of truth (#35747) 2018-02-07 15:11:36 -08:00
win_template.py Windows: Use the correct newline sequence for the platform (#21846) 2017-03-23 19:47:10 -07:00
win_updates.py win_updates: fix regression when using string cat names (#36015) 2018-02-15 06:14:06 +10:00