This commit is contained in:
2025-10-23 04:55:46 +03:00
parent b6bc15fd17
commit f0d0fe9760
4 changed files with 112 additions and 17 deletions

View File

@@ -43,6 +43,21 @@
target_version: "{{ target_version | default('') }}"
target_version_full: "{{ target_version_full | default(target_version | default('')) }}"
- name: Debug | snapshot of incoming scheduler metadata
delegate_to: localhost
when: debug_aic | bool
ansible.builtin.debug:
msg:
- "attempt={{ attempt | default('') }}"
- "max_attempts={{ max_attempts | default('') }}"
- "current_delay_sec={{ current_delay_sec | default('') }}"
- "correlation_id={{ correlation_id | default('') }}"
- "original_emitted_at={{ original_emitted_at | default('') }}"
- "target_version_full={{ target_version_full | default('') }}"
- "target_version={{ target_version | default('') }}"
- "schema_version={{ schema_version | default('') }}"
# Visibility of what scheduler sent
- name: Debug show received scheduler metadata
delegate_to: localhost
@@ -152,8 +167,8 @@
max_attempts: "{{ effective_max_attempts | int }}"
correlation_id: "{{ correlation_id }}"
original_emitted_at: "{{ original_emitted_at }}"
target_version_full: "{{ target_version_full }}" # <-- ADD
target_version: "{{ target_version | default(target_version_full) }}" # <-- ADD (keeps core if it was sent)
target_version_full: "{{ target_version_full }}"
target_version: "{{ target_version | default(target_version_full) }}"
current_delay_sec: "{{ next_delay_sec | int }}"
schema_version: 1
@@ -336,6 +351,15 @@
changed_when: false
ignore_errors: true
- name: Debug | banner normalization inputs
delegate_to: localhost
when: debug_aic | bool
ansible.builtin.debug:
msg:
- "banner_raw={{ (firmware_banner.stdout | default(firmware_banner) | default('')) | trim }}"
- "normalize rule: '2.2.1 rev 6801' -> '2.2.1-r6801'"
- name: Debug show raw firmware readout from DEV2
delegate_to: localhost
ansible.builtin.debug:
@@ -365,6 +389,16 @@
ansible.builtin.set_fact:
expected_norm_step1: "{{ (target_version_full | default('') | trim) }}"
- name: Debug | expected target base and regex extraction inputs
delegate_to: localhost
when: debug_aic | bool
ansible.builtin.debug:
msg:
- "target_version(raw)={{ target_version | default('') }}"
- "target_version_full(raw)={{ target_version_full | default('') }}"
- "regex='[0-9]+\\.[0-9]+\\.[0-9]+-r[0-9]+'"
- name: Extract version core X dot Y dot Z dash rNNNN from target if present
delegate_to: localhost
ansible.builtin.set_fact:
@@ -380,6 +414,14 @@
ansible.builtin.set_fact:
expected_norm: "{{ (expected_norm_core | default('') | length > 0) | ternary(expected_norm_core, expected_norm_step1) }}"
- name: Debug | final expected normalized version (what we will compare against)
delegate_to: localhost
when: debug_aic | bool
ansible.builtin.debug:
msg:
- "expected_norm={{ expected_norm | default('') }}"
# 1 capture raw banner line from DEV2
- name: Capture firmware banner line from DEV2
delegate_to: localhost
@@ -399,6 +441,24 @@
)
}}
- name: Debug | banner normalized result
delegate_to: localhost
when: debug_aic | bool
ansible.builtin.debug:
msg:
- "banner_norm={{ banner_norm | default('') }}"
- name: Debug | version compare inputs and strategy
delegate_to: localhost
when: debug_aic | bool
ansible.builtin.debug:
msg:
- "expected_norm={{ expected_norm | default('') }}"
- "banner_norm={{ banner_norm | default('') }}"
- "eq={{ (expected_norm | default('')) == (banner_norm | default('')) }}"
- "substr={{ (banner_norm | default('')) is search((expected_norm | default('')), ignorecase=False) if (expected_norm | default('') | length) > 0 else 'N/A' }}"
- name: Evaluate version match using normalized equality or substring
delegate_to: localhost
ansible.builtin.set_fact:
@@ -412,6 +472,14 @@
)
}}
- name: Debug | version match outcome
delegate_to: localhost
when: debug_aic | bool
ansible.builtin.debug:
msg:
- "version_match={{ version_match | default(false) }}"
- name: Debug snapshot of expected and actual normalized versions
delegate_to: localhost
ansible.builtin.debug:
@@ -700,11 +768,21 @@
max_attempts: "{{ effective_max_attempts | int }}"
correlation_id: "{{ correlation_id | default('') }}"
original_emitted_at: "{{ original_emitted_at | default('') }}"
target_version_full: "{{ target_version_full }}" # <-- ADD
target_version: "{{ target_version | default(target_version_full) }}" # <-- ADD
target_version_full: "{{ target_version_full }}"
target_version: "{{ target_version | default(target_version_full) }}"
current_delay_sec: "{{ next_delay_sec | int }}"
schema_version: 1
- name: Debug | next attempt backoff plan
delegate_to: localhost
when: debug_aic | bool and (version_match | default(false) | bool) == false
ansible.builtin.debug:
msg:
- "attempt={{ attempt | default('') }} / max_attempts={{ max_attempts | default('') }}"
- "next_delay_sec={{ next_delay_sec | default('') }}"
- "routing_key={{ routing_key | default('deviceconfig') }}"
- "correlation_id={{ correlation_id | default('') }}"
- name: Publish delayed next indoor attempt to holding with TTL routed to deviceconfig
when: delayed_payload is defined
delegate_to: localhost