From 4689a7d938713bd1369749940e77b24156aba95f Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 20 Apr 2021 14:17:54 +1000 Subject: [PATCH] nodepool-functional : ignore errors copying logs If the job stops before the required directories here are created we get a failure copying, which stops us collecting things that may be useful to diagnosing the error. Put the copying in a block that ignores errors. Also just copy the /var/log/syslog -- I think this came in originally from something running on CentOS which doesn't have this, but now we run on Ubuntu hosts and syslog has interesting things for diagnosing errors. Change-Id: Iaca4801a652ef4a67772c804271ea5c1db377051 --- .../post.yaml | 80 ++++++++----------- .../nodepool-functional-openstack/post.yaml | 67 +++++++--------- 2 files changed, 64 insertions(+), 83 deletions(-) diff --git a/playbooks/nodepool-functional-container-openstack/post.yaml b/playbooks/nodepool-functional-container-openstack/post.yaml index 441449d07..9e1aedbd9 100644 --- a/playbooks/nodepool-functional-container-openstack/post.yaml +++ b/playbooks/nodepool-functional-container-openstack/post.yaml @@ -2,49 +2,39 @@ roles: - collect-container-logs tasks: - - name: Copy nodepool log files - synchronize: - src: /var/log/nodepool - dest: '{{ zuul.executor.log_root }}' - mode: pull - - name: Copy nodepool config files - synchronize: - src: /etc/nodepool - dest: '{{ zuul.executor.log_root }}' - mode: pull - - name: Copy instance console logs - become: true - synchronize: - src: /opt/stack/data/nova/instances - dest: '{{ zuul.executor.log_root }}' - mode: pull - rsync_opts: - - "--include=*/" - - "--include=console.log" - - "--exclude=*" - - name: Export legacy syslog.txt - become: true - shell: - # The journal contains everything running under systemd, we'll - # build an old school version of the syslog with just the - # kernel and sudo messages. - cmd: | - journalctl \ - -t kernel \ - -t sudo \ - --no-pager \ - | gzip - > {{ ansible_user_dir }}/syslog.txt.gz + - name: Copy nodepool logs + ignore_errors: yes + block: + - name: Copy nodepool log files + synchronize: + src: /var/log/nodepool + dest: '{{ zuul.executor.log_root }}' + mode: pull + - name: Copy nodepool config files + synchronize: + src: /etc/nodepool + dest: '{{ zuul.executor.log_root }}' + mode: pull + - name: Copy instance console logs + become: true + synchronize: + src: /opt/stack/data/nova/instances + dest: '{{ zuul.executor.log_root }}' + mode: pull + rsync_opts: + - "--include=*/" + - "--include=console.log" + - "--exclude=*" + - name: Copy syslog + become: True + synchronize: + src: "/var/log/syslog" + dest: '{{ zuul.executor.log_root }}' + mode: pull - - name: Copy syslog - become: True - synchronize: - src: "{{ ansible_user_dir }}/syslog.txt.gz" - dest: '{{ zuul.executor.log_root }}' - mode: pull - - - name: Copy docker logs - become: True - synchronize: - src: '{{ ansible_user_dir }}/zuul-output/logs/docker' - dest: '{{ zuul.executor.log_root }}' - mode: pull + - name: Copy docker logs + become: True + synchronize: + src: '{{ ansible_user_dir }}/zuul-output/logs/docker' + dest: '{{ zuul.executor.log_root }}' + mode: pull diff --git a/playbooks/nodepool-functional-openstack/post.yaml b/playbooks/nodepool-functional-openstack/post.yaml index fd074e535..ee9081c05 100644 --- a/playbooks/nodepool-functional-openstack/post.yaml +++ b/playbooks/nodepool-functional-openstack/post.yaml @@ -1,40 +1,31 @@ - hosts: all tasks: - - name: Copy nodepool log files - synchronize: - src: /var/log/nodepool - dest: '{{ zuul.executor.log_root }}' - mode: pull - - name: Copy nodepool config files - synchronize: - src: /etc/nodepool - dest: '{{ zuul.executor.log_root }}' - mode: pull - - name: Copy instance console logs - become: true - synchronize: - src: /opt/stack/data/nova/instances - dest: '{{ zuul.executor.log_root }}' - mode: pull - rsync_opts: - - "--include=*/" - - "--include=console.log" - - "--exclude=*" - - name: Export legacy syslog.txt - become: true - shell: - # The journal contains everything running under systemd, we'll - # build an old school version of the syslog with just the - # kernel and sudo messages. - cmd: | - journalctl \ - -t kernel \ - -t sudo \ - --no-pager \ - | gzip - > {{ ansible_user_dir }}/syslog.txt.gz - - name: Copy syslog - become: True - synchronize: - src: "{{ ansible_user_dir }}/syslog.txt.gz" - dest: '{{ zuul.executor.log_root }}' - mode: pull + - name: Copy logs + ignore_errors: yes + block: + - name: Copy nodepool log files + synchronize: + src: /var/log/nodepool + dest: '{{ zuul.executor.log_root }}' + mode: pull + - name: Copy nodepool config files + synchronize: + src: /etc/nodepool + dest: '{{ zuul.executor.log_root }}' + mode: pull + - name: Copy instance console logs + become: true + synchronize: + src: /opt/stack/data/nova/instances + dest: '{{ zuul.executor.log_root }}' + mode: pull + rsync_opts: + - "--include=*/" + - "--include=console.log" + - "--exclude=*" + - name: Copy syslog + become: True + synchronize: + src: "/var/log/syslog" + dest: '{{ zuul.executor.log_root }}' + mode: pull