This commit is contained in:
2025-10-22 19:14:07 +03:00
parent 4a05b151b8
commit 2a3ef26cdb

View File

@@ -42,7 +42,7 @@
target_version: "{{ target_version | default('') }}"
target_version_full: "{{ target_version | default('') }}"
# (NEW) Show what we received from the scheduler (for easy troubleshooting)
# (NEW) Show what we received from the scheduler
- name: Debug received scheduler metadata
delegate_to: localhost
ansible.builtin.debug:
@@ -53,7 +53,7 @@
- "original_emitted_at={{ original_emitted_at }}"
- "target_version_full={{ target_version_full }}"
# ---- Controller-side TCP probe to DEV1 (no SSH to target yet) ----
# ---- Controller-side TCP probe to DEV1 ----
- name: Check if TCP 22 on DEV1 is reachable
delegate_to: localhost
ansible.builtin.shell: |
@@ -355,20 +355,28 @@
and (not (((dev2_fwver.stdout | default('unknown')) | lower) is search('unknown'))) }}"
# ===================== Unconditional normalization + comparison =====================
# Compute expected_norm from target_version_full. If the full filename-like string is sent,
# extract the "X.Y.Z-rNNNN" core; otherwise use the trimmed original.
# Compute expected_norm from target_version_full. If a whole filename is sent,
# extract "X.Y.Z-rNNNN"; otherwise keep the original trimmed string.
- name: Normalize expected target string step 1 compute components
- name: Normalize expected target step 1 compute base
delegate_to: localhost
ansible.builtin.set_fact:
expected_norm_step1: "{{ (target_version_full | default('') | trim) }}"
expected_norm_core_list: "{{ (target_version_full | default('') | regex_findall('[0-9]+\\.[0-9]+\\.[0-9]+-r[0-9]+')) | default([]) }}"
expected_norm_core: "{{ (expected_norm_core_list | length > 0) | ternary(expected_norm_core_list[0], '') }}"
- name: Normalize expected target string step 2 choose core if present
- name: Extract version core X.Y.Z-rNNNN from target if present
delegate_to: localhost
ansible.builtin.set_fact:
expected_norm: "{{ (expected_norm_core | length > 0) | ternary(expected_norm_core, expected_norm_step1) }}"
expected_norm_core_list: "{{ (target_version_full | default('') | regex_findall('[0-9]+\\.[0-9]+\\.[0-9]+-r[0-9]+')) | default([]) }}"
- name: Choose first core if present
delegate_to: localhost
ansible.builtin.set_fact:
expected_norm_core: "{{ (expected_norm_core_list | default([]) | length > 0) | ternary((expected_norm_core_list | first), '') }}"
- name: Normalize expected target step 2 choose core if present
delegate_to: localhost
ansible.builtin.set_fact:
expected_norm: "{{ (expected_norm_core | default('') | length > 0) | ternary(expected_norm_core, expected_norm_step1) }}"
# Normalize banner/firmux from DEV2 convert '... rev 6801' to '...-r6801'
- name: Normalize banner firmux string from DEV2
@@ -406,7 +414,7 @@
- "version_match={{ version_match | default(false) }}"
# ===================== Journaling/Tagging paths =====================
# SUCCESS: read_ok AND version_match
# SUCCESS path
- name: Build success journal payload
when: (read_ok | bool) and (version_match | bool)
delegate_to: localhost
@@ -560,7 +568,7 @@
register: rmq_customfield_fw
changed_when: (rmq_customfield_fw.json is defined) and (rmq_customfield_fw.json.routed | default(false) | bool)
# MISMATCH path: firmware readable but does NOT match expected target
# MISMATCH path
- name: Build mismatch journal payload
when: (read_ok | bool) and (not (version_match | bool))
delegate_to: localhost
@@ -599,7 +607,7 @@
when: journal_mismatch_payload is defined
ansible.builtin.meta: end_host
# FAILURE / RETRY PATH: journal + schedule next attempt (up to 3 total), 10 minutes apart
# FAILURE / RETRY PATH
- name: Build failure journal payload indoor firmware read failed
when: not (read_ok | bool)
delegate_to: localhost
@@ -622,8 +630,7 @@
password: "{{ rmq_pass }}"
force_basic_auth: true
status_code: 200
headers:
content-type: "application/json"
headers: { content-type: "application/json" }
body_format: json
body:
properties:
@@ -663,8 +670,7 @@
password: "{{ rmq_pass }}"
force_basic_auth: true
status_code: 200
headers:
content-type: "application/json"
headers: { content-type: "application/json" }
body_format: json
body:
properties:
@@ -675,7 +681,7 @@
register: rmq_pub_gaveup
changed_when: (rmq_pub_gaveup.json is defined) and (rmq_pub_gaveup.json.routed | default(false) | bool)
# Only schedule next attempt if we still have budget left
# Only schedule next attempt if budget left
- name: Build delayed payload for next indoor attempt 10 min
when: (not (read_ok | bool)) and ((attempt | int) < (effective_max_attempts | int))
delegate_to: localhost
@@ -700,8 +706,7 @@
password: "{{ rmq_pass }}"
force_basic_auth: true
status_code: 200
headers:
content-type: "application/json"
headers: { content-type: "application/json" }
body_format: json
body:
properties: