Port gathering logs routine from .functests to post ansible yaml

Change-Id: I5cc87cac7eb2a36b8c86a4807592d3ee64d94780
This commit is contained in:
Kota Tsuyuzaki 2019-11-08 14:55:57 +09:00
parent cda48e29ca
commit 28677c0113
3 changed files with 63 additions and 18 deletions

View File

@ -23,19 +23,3 @@ if [ "$FLAVOR" == "jenkins" ]; then
else else
nosetests --exe -v -a '!slow' ${@:2} nosetests --exe -v -a '!slow' ${@:2}
fi fi
rvalue=$?
cd -
# dump log into VIRTUAL_ENV_DIR when this func test call via tox
if [ ! -z "${VIRTUAL_ENV+x}" ]; then
log_dir="${VIRTUAL_ENV}/logs"
mkdir -p ${log_dir}
for log_name in "account-server" "container-server" "object-server" "proxy-server" "ansible" "storlets-daemon" "daemon-factory"; do
log_file="${log_dir}/${log_name}.log"
echo "grep syslog from /var/log/syslog to ${log_file}"
sudo egrep "${log_name}" /var/log/syslog > ${log_file}
sudo chown ${USER}.${USER} ${log_file}
done
fi
exit $rvalue

View File

@ -1,10 +1,41 @@
--- ---
- hosts: all - hosts: all
tasks: tasks:
- name: Create log directory to pull
file:
path: '{{ zuul.project.src_dir }}/logs'
state: directory
- name: Prepare the logs into user space
shell: "egrep {{ item }} /var/log/syslog > {{ zuul.project.src_dir }}/logs/{{ item }}.log"
with_items:
- "account-server"
- "container-server"
- "object-server"
- "proxy-server"
- "ansible"
- "storlets-daemon"
- "daemon-factory"
become: yes
- name: Change log permisson as readable
file:
path: "{{ zuul.project.src_dir }}/logs/{{ item }}.log"
mode: 0644
with_items:
- "account-server"
- "container-server"
- "object-server"
- "proxy-server"
- "ansible"
- "storlets-daemon"
- "daemon-factory"
become: yes
- name: Copy logs from worker nodes to executor node - name: Copy logs from worker nodes to executor node
synchronize: synchronize:
# TODO: make it sort of tox_envdir # TODO: make it sort of tox_envdir
src: '{{ zuul.project.src_dir }}/.tox/func-py3/logs' src: '{{ zuul.project.src_dir }}/logs'
dest: '{{ zuul.executor.log_root }}' dest: '{{ zuul.executor.log_root }}'
mode: pull mode: pull
copy_links: true copy_links: true

View File

@ -1,10 +1,40 @@
--- ---
- hosts: all - hosts: all
tasks: tasks:
- name: Create log directory to pull
file:
path: '{{ zuul.project.src_dir }}/logs'
state: directory
- name: Prepare the logs into user space
shell: "egrep {{ item }} /var/log/syslog > {{ zuul.project.src_dir }}/logs/{{ item }}.log"
with_items:
- "account-server"
- "container-server"
- "object-server"
- "proxy-server"
- "ansible"
- "storlets-daemon"
- "daemon-factory"
become: yes
- name: Change log permisson as readable
file:
path: "{{ zuul.project.src_dir }}/logs/{{ item }}.log"
mode: 0644
with_items:
- "account-server"
- "container-server"
- "object-server"
- "proxy-server"
- "ansible"
- "storlets-daemon"
- "daemon-factory"
- name: Copy logs from worker nodes to executor node - name: Copy logs from worker nodes to executor node
synchronize: synchronize:
# TODO: make it sort of tox_envdir # TODO: make it sort of tox_envdir
src: '{{ zuul.project.src_dir }}/.tox/func/logs' src: '{{ zuul.project.src_dir }}/logs'
dest: '{{ zuul.executor.log_root }}' dest: '{{ zuul.executor.log_root }}'
mode: pull mode: pull
copy_links: true copy_links: true