mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-03 09:13:12 +00:00
Add support for variable_{start,end}_string (#49711)
Template lookup plugin now support variable_start_string and variable_end_string, just like template module. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
@@ -1,20 +1,6 @@
|
||||
# test code for lookup plugins
|
||||
# (c) 2014, James Tanner <tanner.jc@gmail.com>
|
||||
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
# Copyright: (c) 2014, James Tanner <tanner.jc@gmail.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# FILE LOOKUP
|
||||
|
||||
@@ -287,6 +273,17 @@
|
||||
that:
|
||||
- "hello_world|trim == 'Hello world!'"
|
||||
|
||||
|
||||
- name: Test that we have a proper jinja search path in template lookup with different variable start and end string
|
||||
vars:
|
||||
my_var: world
|
||||
set_fact:
|
||||
hello_world_string: "{{ lookup('template', 'hello_string.txt', variable_start_string='[%', variable_end_string='%]') }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "hello_world_string|trim == 'Hello world!'"
|
||||
|
||||
# Vars lookups
|
||||
|
||||
- name: Test that we can give it a single value and receive a single value
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Hello [% my_var %]!
|
||||
Reference in New Issue
Block a user