From c52fb6c5638b61ceeaa654d180bbcece929774f0 Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 24 Dec 2025 10:59:04 +0100 Subject: [PATCH] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Refactor=20tas?= =?UTF-8?q?k=20parsing=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the task parsing algorithm to handle WOL support and state more robustly, ensuring accurate task management. --- tasks/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 7d8bff2..cce793d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,7 +44,7 @@ msg: > {{ wol_check.results | map(attribute='stdout_lines') | list }} -- name: Parse WOL support and state +- name: Parse WOL support and state (robust) ansible.builtin.set_fact: wol_info: >- {{ @@ -55,9 +55,10 @@ ( item.stdout_lines | select('search', '^\\s*Supports Wake-on:') - | join(' ') - | regex_search('g') - ) is not none, + | map('regex_replace', '^\\s*Supports Wake-on:\\s*', '') + | first + | default('') + ).find('g') != -1, 'current_state': ( item.stdout_lines