mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Prevent vars premature templating (#56117)
Avoid premature vars templating * added tests * avoid 'is template' warning in vars, since we want them for latter templating
This commit is contained in:
@@ -348,7 +348,9 @@ class FieldAttributeBase(with_metaclass(BaseMeta, object)):
|
||||
|
||||
if attribute.static:
|
||||
value = getattr(self, name)
|
||||
if templar.is_template(value):
|
||||
|
||||
# we don't template 'vars' but allow template as values for later use
|
||||
if name not in ('vars',) and templar.is_template(value):
|
||||
display.warning('"%s" is not templatable, but we found: %s, '
|
||||
'it will not be templated and will be used "as is".' % (name, value))
|
||||
continue
|
||||
@@ -592,7 +594,7 @@ class Base(FieldAttributeBase):
|
||||
_remote_user = FieldAttribute(isa='string', default=context.cliargs_deferred_get('remote_user'))
|
||||
|
||||
# variables
|
||||
_vars = FieldAttribute(isa='dict', priority=100, inherit=False)
|
||||
_vars = FieldAttribute(isa='dict', priority=100, inherit=False, static=True)
|
||||
|
||||
# module default params
|
||||
_module_defaults = FieldAttribute(isa='list', extend=True, prepend=True)
|
||||
|
||||
Reference in New Issue
Block a user