refactor ♻️: Refactor task parsing logic
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 10s
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 10s
Updated the task parsing algorithm to handle WOL support and state more robustly, ensuring accurate task management.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user