From 28677c01134034c297b54fbb8195b57667065dfd Mon Sep 17 00:00:00 2001 From: Kota Tsuyuzaki Date: Fri, 8 Nov 2019 14:55:57 +0900 Subject: [PATCH] Port gathering logs routine from .functests to post ansible yaml Change-Id: I5cc87cac7eb2a36b8c86a4807592d3ee64d94780 --- .functests | 16 ---------- playbooks/storlets-functional/post-py3.yaml | 33 ++++++++++++++++++++- playbooks/storlets-functional/post.yaml | 32 +++++++++++++++++++- 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/.functests b/.functests index 2dcbc149..7ee71ba3 100755 --- a/.functests +++ b/.functests @@ -23,19 +23,3 @@ if [ "$FLAVOR" == "jenkins" ]; then else nosetests --exe -v -a '!slow' ${@:2} 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 diff --git a/playbooks/storlets-functional/post-py3.yaml b/playbooks/storlets-functional/post-py3.yaml index ac3a296f..1a051b1f 100644 --- a/playbooks/storlets-functional/post-py3.yaml +++ b/playbooks/storlets-functional/post-py3.yaml @@ -1,10 +1,41 @@ --- - hosts: all 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 synchronize: # 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 }}' mode: pull copy_links: true diff --git a/playbooks/storlets-functional/post.yaml b/playbooks/storlets-functional/post.yaml index 76e4ee03..90dec31b 100644 --- a/playbooks/storlets-functional/post.yaml +++ b/playbooks/storlets-functional/post.yaml @@ -1,10 +1,40 @@ --- - hosts: all 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 synchronize: # 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 }}' mode: pull copy_links: true