Support multi node jobs for tox logs

It is possible somebody may want to run tox jobs over multiple nodes.
Check to see if more then one node is in our inventory, if so then add
the inventory_hostname to the log path.

Change-Id: Icd0532cb415fdae42eae6d2269d5a0be5fcdf98a
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-07-21 17:06:14 -04:00
parent 51f2ed4036
commit 851ba9ea4d
No known key found for this signature in database
GPG Key ID: 611A80832067AF38

View File

@ -9,14 +9,25 @@
use_regex: yes
register: result
- name: Set tox log path for multiple nodes
set_fact:
log_path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/tox"
when: groups['all'] | length > 1
- name: Set tox log path for single node
set_fact:
log_path: "{{ zuul.executor.log_root }}/tox"
when: log_path is not defined
- name: Ensure local tox dir
file:
path: "{{ zuul.executor.log_root }}/tox"
path: "{{ log_path }}"
state: directory
delegate_to: localhost
- name: Collect tox logs
synchronize:
dest: "{{ zuul.executor.log_root }}/tox"
dest: "{{ log_path }}"
mode: pull
src: "{{ item.path }}/log/"
verify_host: true