forked from jakub/ansible
Refactor update_collabora.yml: enhance capability fetching with improved JSON parsing and fallback handling
This commit is contained in:
@@ -109,7 +109,6 @@
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when: collab_caps_uri.status | default(0) != 200
|
||||
|
||||
# --- Decide which payload to use (prefer uri if 200) ---
|
||||
- name: Collabora | Select payload source
|
||||
ansible.builtin.set_fact:
|
||||
@@ -120,13 +119,23 @@
|
||||
(collab_caps_vm.stdout | default('')))
|
||||
}}
|
||||
|
||||
# --- Try to parse JSON; if it fails, we'll show raw ---
|
||||
- name: Collabora | Parse JSON if possible
|
||||
# --- Prefer JSON object provided by uri module when available ---
|
||||
- name: Collabora | Prefer JSON from controller if available # English comments
|
||||
ansible.builtin.set_fact:
|
||||
collab_caps_json: "{{ collab_caps_uri.json }}"
|
||||
when: collab_caps_uri.json is defined
|
||||
|
||||
# --- Fallback: parse JSON from raw only if it looks like JSON ---
|
||||
- name: Collabora | Fallback parse from raw string
|
||||
ansible.builtin.set_fact:
|
||||
collab_caps_json: "{{ collab_caps_raw | from_json }}"
|
||||
when:
|
||||
- collab_caps_json is not defined
|
||||
- collab_caps_raw is defined
|
||||
- (collab_caps_raw | trim) is match('^\\{')
|
||||
failed_when: false
|
||||
|
||||
# --- Always show a raw payload (useful when response is HTML error like 502) ---
|
||||
# --- Always show a raw payload (useful for 502 HTML or text) ---
|
||||
- name: Collabora | RAW capabilities payload
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
|
||||
Reference in New Issue
Block a user