Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix filters #2379

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/20241129-fix_filter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- plugin_utils/inventory - Fix filter attribute in the inventory too allow env vars (https://github.com/ansible-collections/amazon.aws/pull/2379)
17 changes: 11 additions & 6 deletions plugins/plugin_utils/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TemplatedOptions:
"assume_role_arn",
"region",
"regions",
"filters",
)

def __init__(self, templar, options):
Expand All @@ -51,12 +52,16 @@ def __setitem__(self, *args):

def get(self, *args):
value = self.original_options.get(*args)
if (
not value
or not self.templar
or args[0] not in self.TEMPLATABLE_OPTIONS
or not self.templar.is_template(value)
):
if not value or not self.templar or args[0] not in self.TEMPLATABLE_OPTIONS:
return value

if isinstance(value, dict):
new = {}
for i in value:
new[i] = self.templar.template(variable=value[i], disable_lookups=False)
return new

t794104 marked this conversation as resolved.
Show resolved Hide resolved
elif not self.templar.is_template(value):
return value

return self.templar.template(variable=value, disable_lookups=False)
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.18.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this
plugins/modules/ec2_vpc_peering.py pylint:collection-deprecated-version
Loading