refactor ♻️: Refactor loop for improved readability and efficiency

This refactoring improves the readability and efficiency of the loop by simplifying the logic and reducing redundant operations.
This commit is contained in:
2025-12-23 22:14:22 +01:00
parent aa5615533e
commit c4c786f19b

View File

@@ -47,12 +47,14 @@
{{ {{
wol_detected_interfaces | combine({ wol_detected_interfaces | combine({
item: ( item: (
bridge_links.stdout_lines [
| select('search', 'master ' ~ item) line | regex_search('^\\d+: ([a-z0-9@.]+):', '\\1') | first
| map('regex_replace', '^\\d+: ([^:@]+):.*$', '\\1') for line in bridge_links.stdout_lines
| reject('search', '^(veth|tap|fw)') if ('master ' ~ item) in line
| list and not line is search('^\\d+: (veth|tap|fw)')
) | first | default('') ]
| first | default('')
)
}) })
}} }}
loop: "{{ wol_bridges_list }}" loop: "{{ wol_bridges_list }}"