652b78fc51
If the main CI job fails before generating an ARA report, the SQLite database file will not exist. This cases the job to fail with POST_FAILURE, rather than FAILURE, and the following is seen in the logs: rsync: change_dir "/home/zuul/.ara" failed: No such file or directory rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1655) [Receiver=3.1.1] rsync: [Receiver] write error: Broken pipe (32) This change fixes this by checking for an SQLite database file, and only intiating the rsync transfer if it exists. Change-Id: I370e5bc9f137abe552918a3215a025fa61e3a0ca
59 lines
1.6 KiB
YAML
59 lines
1.6 KiB
YAML
---
|
|
- hosts: all
|
|
vars:
|
|
logs_dir: "/tmp/logs"
|
|
tasks:
|
|
- name: Print all facts
|
|
copy:
|
|
content: "{{ hostvars[inventory_hostname] | to_nice_json }}"
|
|
dest: "{{ logs_dir }}/facts.json"
|
|
|
|
- name: Run diagnostics script
|
|
script: get_logs.sh
|
|
register: get_logs_result
|
|
become: true
|
|
failed_when: false
|
|
|
|
- name: Print get_logs output
|
|
debug:
|
|
msg: "{{ get_logs_result.stdout }}"
|
|
|
|
- name: Download /etc/hosts file to executor
|
|
synchronize:
|
|
src: "/etc/hosts"
|
|
dest: "{{ zuul.executor.log_root }}/{{inventory_hostname }}/"
|
|
mode: pull
|
|
ignore_errors: yes
|
|
|
|
- name: dump all iptables rules
|
|
shell: "iptables-save > /tmp/logs/iptables"
|
|
become: true
|
|
|
|
- name: Download /tmp/logs file to executor
|
|
synchronize:
|
|
src: "/tmp/logs"
|
|
dest: "{{ zuul.executor.log_root }}/{{inventory_hostname }}/"
|
|
mode: pull
|
|
|
|
- hosts: primary
|
|
tasks:
|
|
- name: check for existence of ara sqlite
|
|
stat:
|
|
path: "{{ ansible_env.HOME }}/.ara/ansible.sqlite"
|
|
register: ara_stat_result
|
|
|
|
- block:
|
|
- name: ensure ara-report folder existence
|
|
file:
|
|
path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/ara-report"
|
|
state: directory
|
|
delegate_to: localhost
|
|
run_once: true
|
|
|
|
- name: download ara sqlite
|
|
synchronize:
|
|
src: "{{ ansible_env.HOME }}/.ara/ansible.sqlite"
|
|
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/ara-report/"
|
|
mode: pull
|
|
when: ara_stat_result.stat.exists
|