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

[DNM] Fix ipv6 condition #2682

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
8 changes: 3 additions & 5 deletions roles/libvirt_manager/tasks/create_networks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,9 @@
_name: "{{ item | replace('-', '_') }}"
_no_prefix_name: "{{ _name | regex_replace('cifmw[-_]','') }}"
_ipv6: >-
{{
(ansible_facts[_name].ipv6 is defined) |
ternary(ansible_facts[_name].ipv6 |
selectattr('scope', 'equalto', 'global') | first, {})
}}
{% if ansible_facts[_name].ipv6 is defined -%}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What issue are you fixing?

There is no information in the commit message, no link to issue/jira ticket explaining what the problem is.
To me, it looks like you are doing the same thing using a different "style"? If there was a commit message explaining what/why I probably would not have needed to ask these questions. :)

Copy link
Author

@gthiemonge gthiemonge Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just a DNM patch that tries to fix an issue I have in my env.
It looks like the syntax: "var is defined| ternary(var, other_var)" is not correct because ternary always evaluates both parameters.
The patch works for me now, but I'm not sure it covers all the cases
I'll remove the DNM tag if I find a clear/better solution

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shifting to draft status due to this comment @gthiemonge , please update the PR is anything changes :)

{{ ansible_facts[_name].ipv6 | selectattr('scope', 'equalto', 'global') | first }}
{% endif -%}
_default_gw_net: >-
{% set out = '' -%}
{% if cifmw_libvirt_manager_default_gw_nets is defined -%}
Expand Down
Loading