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