debug: Add comprehensive debugging for drift detection and JSON POSTing
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Add debug output showing rsyslogd_check.diff structure - Simplify file extraction logic for rsyslog.d directory changes - Show full JSON payload before sending to API - Add connectivity test to gitops-status-server before POST - Show curl command and response codes for debugging - Display warning if OUT_OF_SYNC but no files extracted This helps diagnose why drift is detected but files aren't listed in the JSON.
This commit is contained in:
parent
de99902959
commit
5285f4c241
@ -102,6 +102,15 @@
|
|||||||
msg: "rsyslogd_check details: {{ rsyslogd_check }}"
|
msg: "rsyslogd_check details: {{ rsyslogd_check }}"
|
||||||
when: rsyslogd_check.changed
|
when: rsyslogd_check.changed
|
||||||
|
|
||||||
|
- name: Debug rsyslogd_check.diff structure
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: |
|
||||||
|
rsyslogd_check.diff is list: {{ rsyslogd_check.diff is iterable and rsyslogd_check.diff is not string }}
|
||||||
|
rsyslogd_check.diff length: {{ rsyslogd_check.diff | length if rsyslogd_check.diff is iterable else 'N/A' }}
|
||||||
|
rsyslogd_check.diff first item: {{ rsyslogd_check.diff[0] if rsyslogd_check.diff is iterable and rsyslogd_check.diff | length > 0 else 'empty' }}
|
||||||
|
Full diff content: {{ rsyslogd_check.diff }}
|
||||||
|
when: rsyslogd_check.changed and rsyslogd_check.diff is defined
|
||||||
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────
|
||||||
# Build structured list of changed files for GitOps status server
|
# Build structured list of changed files for GitOps status server
|
||||||
# This data is parsed by the update-gitops-status.sh wrapper script
|
# This data is parsed by the update-gitops-status.sh wrapper script
|
||||||
@ -115,17 +124,19 @@
|
|||||||
drifted_files: "{{ drifted_files + ['/etc/rsyslog.conf'] }}"
|
drifted_files: "{{ drifted_files + ['/etc/rsyslog.conf'] }}"
|
||||||
when: main_config_check.changed
|
when: main_config_check.changed
|
||||||
|
|
||||||
- name: Extract specific rsyslog.d files that changed
|
- name: Debug rsyslogd_check structure
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "rsyslogd_check.diff type: {{ rsyslogd_check.diff is iterable }}, content: {{ rsyslogd_check.diff }}"
|
||||||
|
when: rsyslogd_check.changed and rsyslogd_check.diff is defined
|
||||||
|
|
||||||
|
- name: Mark rsyslog.d directory as changed (simplified)
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
changed_rsyslogd_files: "{{ rsyslogd_check.diff | map(attribute='dest') | list if rsyslogd_check.diff is defined else [] }}"
|
drifted_files: "{{ drifted_files + ['/etc/rsyslog.d/'] }}"
|
||||||
when: rsyslogd_check.changed
|
when: rsyslogd_check.changed
|
||||||
|
|
||||||
- name: Add changed rsyslog.d files to drifted list
|
- name: Debug changed files list after rsyslog.d check
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.debug:
|
||||||
drifted_files: "{{ drifted_files + changed_rsyslogd_files }}"
|
msg: "Drifted files after rsyslog.d: {{ drifted_files }}"
|
||||||
when:
|
|
||||||
- rsyslogd_check.changed
|
|
||||||
- changed_rsyslogd_files is defined and changed_rsyslogd_files | length > 0
|
|
||||||
|
|
||||||
- name: Add missing files to drifted list
|
- name: Add missing files to drifted list
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
|
|||||||
@ -221,6 +221,12 @@ echo ""
|
|||||||
echo "Step 4/4: Sending status to gitops-status-server..."
|
echo "Step 4/4: Sending status to gitops-status-server..."
|
||||||
echo " URL: $GITOPS_STATUS_SERVER_URL/api/status"
|
echo " URL: $GITOPS_STATUS_SERVER_URL/api/status"
|
||||||
echo " Method: POST"
|
echo " Method: POST"
|
||||||
|
echo " Request Payload:"
|
||||||
|
echo "$STATUS_JSON" | jq '.' 2>/dev/null | sed 's/^/ /' || echo "$STATUS_JSON" | sed 's/^/ /'
|
||||||
|
echo ""
|
||||||
|
echo "Step 4/4: Sending status to gitops-status-server..."
|
||||||
|
echo " URL: $GITOPS_STATUS_SERVER_URL/api/status"
|
||||||
|
echo " Method: POST"
|
||||||
echo " Payload size: $(echo "$STATUS_JSON" | wc -c) bytes"
|
echo " Payload size: $(echo "$STATUS_JSON" | wc -c) bytes"
|
||||||
echo ""
|
echo ""
|
||||||
echo " ========== JSON PAYLOAD BEING SENT =========="
|
echo " ========== JSON PAYLOAD BEING SENT =========="
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user