From 3e4d77962aa7e8f5ecfa379a20a3da310749ba4b Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 8 Mar 2018 14:37:06 -0600 Subject: [PATCH] scripts: adds a collect_ceph_logs function This function will use ansible to connect to all testing vms and fetch in ceph logs to the jenkins slave. These logs can then be archived by jenkins. Signed-off-by: Andrew Schoen --- scripts/build_utils.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/build_utils.sh b/scripts/build_utils.sh index 42a86361..a5436d9f 100644 --- a/scripts/build_utils.sh +++ b/scripts/build_utils.sh @@ -697,3 +697,25 @@ write_collect_logs_playbook() { with_items: "{{ ceph_logs.stdout_lines }}" EOF } + +collect_ceph_logs() { + # this is meant to be run in a testing scenario directory + # with running vagrant vms. the ansible playbook will connect + # to your test nodes and fetch any ceph logs that are present + # in /var/log/ceph and store them on the jenkins slave. + # these logs can then be archived using the JJB archive publisher + limit=$1 + + if [ -f "./vagrant_ssh_config" ]; then + mkdir -p $WORKSPACE/logs + + write_collect_logs_playbook + + pkgs=( "ansible" ) + install_python_packages "pkgs[@]" + + export ANSIBLE_SSH_ARGS='-F ./vagrant_ssh_config' + export ANSIBLE_STDOUT_CALLBACK='debug' + $VENV/ansible-playbook -vv -i hosts --limit $limit --extra-vars "archive_path=$WORKSPACE/logs" $WORKSPACE/collect-logs.yml + fi +} -- 2.39.5