Debug api request
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
dvirlabs 2026-04-23 11:40:17 +03:00
parent e8fed366b4
commit cdec5ce87c
2 changed files with 16 additions and 9 deletions

View File

@ -13,14 +13,14 @@
# against live server files without actually writing anything. # against live server files without actually writing anything.
# changed=true → file differs → drift # changed=true → file differs → drift
# changed=false → files match → synced # changed=false → files match → synced
#
# NOTE: Only checking file CONTENT, not permissions/ownership
# The validate.yml playbook enforces permissions on deploy
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
- name: Check main rsyslog.conf - name: Check main rsyslog.conf
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ playbook_dir }}/../../files/rsyslog.conf" src: "{{ playbook_dir }}/../../files/rsyslog.conf"
dest: "{{ rsyslog_main_config }}" dest: "{{ rsyslog_main_config }}"
owner: root
group: root
mode: '0644'
check_mode: true check_mode: true
diff: true diff: true
register: main_config_check register: main_config_check
@ -29,9 +29,6 @@
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ playbook_dir }}/../../files/rsyslog.d/" src: "{{ playbook_dir }}/../../files/rsyslog.d/"
dest: "{{ rsyslog_config_dir }}/" dest: "{{ rsyslog_config_dir }}/"
owner: root
group: root
mode: '0644'
check_mode: true check_mode: true
diff: true diff: true
register: rsyslogd_check register: rsyslogd_check
@ -85,12 +82,10 @@
- name: Show main config change status - name: Show main config change status
ansible.builtin.debug: ansible.builtin.debug:
msg: "Main config (rsyslog.conf) changed: {{ main_config_check.changed }}" msg: "Main config (rsyslog.conf) changed: {{ main_config_check.changed }}"
when: drift_detected
- name: Show rsyslog.d change status - name: Show rsyslog.d change status
ansible.builtin.debug: ansible.builtin.debug:
msg: "rsyslog.d directory changed: {{ rsyslogd_check.changed }}" msg: "rsyslog.d directory changed: {{ rsyslogd_check.changed }}"
when: drift_detected
- name: Show main config diff if changed - name: Show main config diff if changed
ansible.builtin.debug: ansible.builtin.debug:
@ -102,6 +97,11 @@
var: rsyslogd_check.diff var: rsyslogd_check.diff
when: rsyslogd_check.changed and rsyslogd_check.diff is defined when: rsyslogd_check.changed and rsyslogd_check.diff is defined
- name: Show rsyslog.d diff list
ansible.builtin.debug:
msg: "rsyslogd_check details: {{ rsyslogd_check }}"
when: rsyslogd_check.changed
# ───────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────
# 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

View File

@ -223,6 +223,10 @@ echo " URL: $GITOPS_STATUS_SERVER_URL/api/status"
echo " Method: POST" 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 "$STATUS_JSON" | jq '.' 2>/dev/null || echo "$STATUS_JSON"
echo " =========================================="
echo ""
# Test connectivity first # Test connectivity first
echo " Testing connectivity to gitops-status-server..." echo " Testing connectivity to gitops-status-server..."
@ -240,7 +244,10 @@ echo ""
RESPONSE_BODY=$(mktemp) RESPONSE_BODY=$(mktemp)
trap "rm -f $RESPONSE_BODY $PLAYBOOK_LOG" EXIT trap "rm -f $RESPONSE_BODY $PLAYBOOK_LOG" EXIT
echo " Sending POST request..." echo " Sending POST request with curl..."
echo " Command: curl -X POST -H 'Content-Type: application/json' -d '<JSON>' $GITOPS_STATUS_SERVER_URL/api/status"
echo ""
# POST the JSON to the gitops-status-server API with full error reporting # POST the JSON to the gitops-status-server API with full error reporting
# Capture both response code and body for debugging # Capture both response code and body for debugging
set +e set +e