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

[FEATURE REQUEST] Jinja filter for wrapping IPv6 addresses in brackets ([ ]) #61931

Closed
ggiesen opened this issue Apr 8, 2022 · 0 comments · Fixed by #61933
Closed

[FEATURE REQUEST] Jinja filter for wrapping IPv6 addresses in brackets ([ ]) #61931

ggiesen opened this issue Apr 8, 2022 · 0 comments · Fixed by #61933
Labels
Feature new functionality including changes to functionality and code refactors, etc.
Milestone

Comments

@ggiesen
Copy link
Contributor

ggiesen commented Apr 8, 2022

Is your feature request related to a problem? Please describe.
A great deal of software that IPv6 addresses for configuration files, especially when a port or url is specified, to be wrapped in brackets ([ ]). There's currently no clean or easy way to do this (that I'm aware of )

Describe the solution you'd like
A jinja filter like Ansibles ipwrap() ( https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters_ipaddr.html#wrapping-ipv6-addresses-in-brackets )

Describe alternatives you've considered
Using something like the following:

{{ address if not address|is_ipv6 else ['[', address, ']']|join }}

But this will wrap IPv6 addresses with CIDR masks incorrectly. ie 2001:db8::1/64 becomes [2001:db8::1/64] instead of [2001:db8::1]/64.

@ggiesen ggiesen added Feature new functionality including changes to functionality and code refactors, etc. needs-triage labels Apr 8, 2022
@ggiesen ggiesen changed the title [FEATURE REQUEST] [FEATURE REQUEST] Jinja filter for wrapping IPv6 addresses in brackets ([ ]) Apr 8, 2022
@ggiesen ggiesen mentioned this issue Apr 8, 2022
3 tasks
@OrangeDog OrangeDog added this to the Approved milestone Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature new functionality including changes to functionality and code refactors, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants