Fix regression introduced in b77abd0491 causing bug in inventory modu… (#73429)

* Fix regression introduced in b77abd0491 causing bug in inventory modules which break functionality in user setting  use_contrib_script_compatible_sanitization  parameter.

* Add changelog

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
This commit is contained in:
Michael Shnit 2021-02-05 00:25:08 +02:00 committed by GitHub
parent 7cef930aa4
commit 4315e18807
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1,4 @@
bugfixes:
- inventory plugins - Let plugins define the sanitization method for the constructed ``groups`` feature.
minor_changes:
- constructed inventory plugin - Sanitize group names created from the ``groups`` option silently.

View file

@ -389,7 +389,7 @@ class Constructable(object):
self.templar.available_variables = variables
for group_name in groups:
conditional = "{%% if %s %%} True {%% else %%} False {%% endif %%}" % groups[group_name]
group_name = original_safe(group_name, force=True)
group_name = self._sanitize_group_name(group_name)
try:
result = boolean(self.templar.template(conditional))
except Exception as e: