This commit is contained in:
2025-11-19 22:20:28 +02:00
parent 001d41f121
commit 85281432a9

View File

@@ -81,19 +81,36 @@
- "{{ (nb_preflight.stderr_lines | default(['<no stderr>'])) }}"
- "raw stdout (joined): {{ nb_preflight.stdout | default('') | trim }}"
# --- Detect cloud failure (rc==3 or FAIL Cloud line) ---
- name: "NB preflight | Detect cloud failure"
when: nb_script.stat.exists
delegate_to: localhost
vars:
_out: "{{ (nb_preflight.stdout | default('') | regex_replace('\r','')) }}"
_lines: >-
{{ (nb_preflight.stdout | default('') | regex_replace('\r','')) | split('\n') | map('trim') | list }}
{{ _out.split('\n') | map('trim') | list }}
_cloud_fail_line: >-
{{ (_lines | select('match', '^FAIL\\s+Cloud\\b') | list | last | default('')) }}
_error_line: >-
{{ (_lines | select('match', '^FAIL\\s+') | list | last | default('')) }}
_rc_is_3: "{{ (nb_preflight.rc | default(1)) | int == 3 }}"
_cloud_error_type: >-
{%- if _error_line is search('network error')
and _error_line is search('500 error responses') -%}
cloud_http_500
{%- elif (_cloud_fail_line | length) > 0 -%}
cloud_logic
{%- elif _rc_is_3 -%}
cloud_other
{%- else -%}
none
{%- endif -%}
_cloud_retryable: >-
{{ _cloud_error_type not in ['cloud_http_500'] }}
set_fact:
cloud_fail_line: "{{ _cloud_fail_line }}"
cloud_bad: "{{ _rc_is_3 or (( _cloud_fail_line | length ) > 0) }}"
cloud_error_type: "{{ _cloud_error_type }}"
cloud_retryable: "{{ _cloud_retryable }}"
# --- Extract upgrade_cmd line if any ---
- name: "NB preflight | Extract upgrade_cmd line"