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

Add filter remove_keys #8442

Closed
1 task done
vbotka opened this issue May 31, 2024 · 2 comments · Fixed by #8443
Closed
1 task done

Add filter remove_keys #8442

vbotka opened this issue May 31, 2024 · 2 comments · Fixed by #8443
Labels
feature This issue/PR relates to a feature request has_pr

Comments

@vbotka
Copy link
Contributor

vbotka commented May 31, 2024

Summary

Create filter remove_keys.

The collection ansible.utils provides the filter remove_keys. Unfortunately, it is not working properly. See remove_keys filter remove empty string from list #247.

There is already feature request #8438 and PR #8456 to add filter keep_keys. This filter will be an easy complement. The goal is to keep the code simple and test it properly.

Issue Type

Feature Idea

Component Name

community.genera.remove_keys

Additional Information

  t: [k0, k1]
  l1:
    - {k0: A, k1: B, k2: C}
    - {k0: D, k1: E, k2: F}
  r1: "{{ l1 | community.general.remove_keys(target=t) }}"

gives

  r1:
  - k2: C
  - k2: F

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:
None

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added the feature This issue/PR relates to a feature request label May 31, 2024
@vbotka
Copy link
Contributor Author

vbotka commented Jun 3, 2024

This feature request is implemented in PR #8443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request has_pr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants