Fix several issues with upload-logs role

Change-Id: I09d4fae4acde6122a890c313eefbbcf4c27ef203
This commit is contained in:
James E. Blair 2017-06-28 14:28:25 -07:00
parent 47c850f0e3
commit 65a44f2489
1 changed files with 15 additions and 8 deletions

View File

@ -1,15 +1,22 @@
- name: Set log path for a change.
when: zuul.change
- name: Set log path for a change
when: zuul.change is defined
set_fact:
log_path: "{{ zuul.change[:-2] }}/{{ zuul.change }}/{{ zuul.patchset }}/{{ zuul.pipeline }}/{{ zuul.uuid[:7] }}/"
log_path: "{{ zuul.change[-2:] }}/{{ zuul.change }}/{{ zuul.patchset }}/{{ zuul.pipeline }}/{{ zuul.uuid[:7] }}"
- name: Set log path for a ref update.
when: zuul.newrev
- name: Set log path for a ref update
when: zuul.newrev is defined
set_fact:
log_path: "{{ zuul.newrev[:-2] }}/{{ zuul.newrev }}/{{ zuul.pipeline }}/{{ zuul.uuid[:7] }}/"
log_path: "{{ zuul.newrev[-2:] }}/{{ zuul.newrev }}/{{ zuul.pipeline }}/{{ zuul.uuid[:7] }}"
- name: Upload logs to log server.
- name: Create log directories
file:
path: "/srv/static/logs/{{ log_path }}"
state: directory
recurse: yes
mode: 0775
- name: Upload logs to log server
synchronize:
src: "{{ zuul.executor.log_root }}"
dest: "{{ log_path }}"
dest: "/srv/static/logs/{{ log_path }}"
no_log: true