Merge "Save previous kayobe & kolla configuration"

This commit is contained in:
Zuul 2018-11-22 19:42:09 +00:00 committed by Gerrit Code Review
commit 408ec30f80
4 changed files with 18 additions and 0 deletions

View File

@ -5,4 +5,5 @@
kayobe_diagnostics_phase: "post"
kayobe_diagnostics_log_dir: "/tmp/logs"
kayobe_diagnostics_config_dir: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['git.openstack.org/openstack/kayobe-config-dev'].src_dir }}"
kayobe_diagnostics_previous_config_dir: "{{ ansible_env.PWD ~ '/previous/kayobe-config' }}"
kayobe_diagnostics_executor_log_dir: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"

View File

@ -8,5 +8,9 @@ kayobe_diagnostics_logs_dir:
# Directory on the remote host in which configuration is stored.
kayobe_diagnostics_config_dir:
# Directory on the remote host in which configuration for the previous release,
# prior to an upgrade, is stored.
kayobe_diagnostics_previous_config_dir:
# Directory on the executor in which to save logs.
kayobe_diagnostics_executor_log_dir:

View File

@ -6,6 +6,8 @@
# Environment variables:
# $LOG_DIR is the directory to copy logs to.
# $CONFIG_DIR is the directory to copy configuration from.
# $PREVIOUS_CONFIG_DIR is the directory to copy previous configuration, prior
# to an upgrade, from.
set +o errexit
@ -19,6 +21,16 @@ copy_logs() {
rm ${LOG_DIR}/kayobe_configs/kolla/config/ironic/ironic-agent.{kernel,initramfs}
rm ${LOG_DIR}/kolla_configs/config/ironic/ironic-agent.{kernel,initramfs}
fi
if [[ -n ${PREVIOUS_CONFIG_DIR} ]] && [[ -d ${PREVIOUS_CONFIG_DIR} ]]; then
mkdir -p ${LOG_DIR}/previous_{kayobe,kolla}_configs
cp -rnL ${PREVIOUS_CONFIG_DIR}/etc/kayobe/* ${LOG_DIR}/previous_kayobe_configs
cp -rnL ${PREVIOUS_CONFIG_DIR}/etc/kolla/* ${LOG_DIR}/previous_kolla_configs
# NOTE: we can't save node configs in /etc/kolla for the pervious
# release since they'll have been overwritten at this point.
# Don't save the IPA images.
rm ${LOG_DIR}/previous_kayobe_configs/kolla/config/ironic/ironic-agent.{kernel,initramfs}
rm ${LOG_DIR}/previous_kolla_configs/config/ironic/ironic-agent.{kernel,initramfs}
fi
cp -rvnL /var/log/* ${LOG_DIR}/system_logs/

View File

@ -12,6 +12,7 @@
environment:
LOG_DIR: "{{ kayobe_diagnostics_log_dir }}"
CONFIG_DIR: "{{ kayobe_diagnostics_config_dir }}"
PREVIOUS_CONFIG_DIR: "{{ kayobe_diagnostics_previous_config_dir }}"
- name: Print get_logs.sh output
debug: