From 1112e01cbf3c0065c55cc1d986242d10f840b87d Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 24 Dec 2025 10:48:26 +0100 Subject: [PATCH] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Refactor=20WOL?= =?UTF-8?q?=20status=20extraction=20to=20handle=20multiple=20matches=20saf?= =?UTF-8?q?ely.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This refactoring improves the handling of multiple matches in the WOL status extraction process, ensuring more robust and reliable results. --- tasks/main.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 61606af..f7399c2 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,14 +44,19 @@ msg: > {{ wol_check.results | map(attribute='stdout_lines') | list }} -- name: Build WOL status per interface +- name: Build WOL status per interface (safe) ansible.builtin.set_fact: wol_status: >- {{ wol_status | default({}) | combine({ item.item: - (item.stdout | regex_search('Wake-on:\\s*(\\S+)', '\\1') | default('Not supported')) + ( + item.stdout + | regex_findall('Wake-on:\\s*(\\S+)') + | first + | default('Not supported') + ) }) }} loop: "{{ wol_check.results }}"