Parameterize disable_lookups (#76770)

Allow inventory plugins to enable/disable lookups in the compose templating
pull/76802/head
Mark Mercado 3 years ago committed by GitHub
parent 553e75df95
commit 36519ff95e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- inventory - parameterize ``disable_lookups`` in ``Constructable`` (https://github.com/ansible/ansible/issues/76769).

@ -332,7 +332,7 @@ class Cacheable(object):
class Constructable(object): class Constructable(object):
def _compose(self, template, variables): def _compose(self, template, variables, disable_lookups=True):
''' helper method for plugins to compose variables for Ansible based on jinja2 expression and inventory vars''' ''' helper method for plugins to compose variables for Ansible based on jinja2 expression and inventory vars'''
t = self.templar t = self.templar
@ -346,7 +346,8 @@ class Constructable(object):
else: else:
t.available_variables = variables t.available_variables = variables
return t.template('%s%s%s' % (t.environment.variable_start_string, template, t.environment.variable_end_string), disable_lookups=True) return t.template('%s%s%s' % (t.environment.variable_start_string, template, t.environment.variable_end_string),
disable_lookups=disable_lookups)
def _set_composite_vars(self, compose, variables, host, strict=False): def _set_composite_vars(self, compose, variables, host, strict=False):
''' loops over compose entries to create vars for hosts ''' ''' loops over compose entries to create vars for hosts '''

Loading…
Cancel
Save